Web Application and Development - asp.net

i have two pages:
1st page... let it be adminfileupload page
2nd page... home page(this will be site home page)
i have one folder in solution explorer named images.
what i want to do is
adminfileupload has one fileupload control and a button named update
when any one browse image file with file upload and click the button(update) then the image should be viewed in home page and also saved in images folder. each time we chose a file and click the button(update) the image should be changed. and this image should be background image, i mean i also have to show some data from database over that image.
working in c# asp.net

Do you need to keep the other pictures too?
If not, you could just upload a picture give it a fix name, Then in the home page you could just set the background image the path to the picture and the fix name. If you have trouble overloading the picture(does not write over you should delete the picture first).But this is a simple approach and depending on the browser you test on it might keep the first picture in their temp file.
If you want to keep the other images you need to do some extra work and have a storing mechanism that will keep track of your pictures or a dynamic variable that changes the path of the resources. I sugest you take a look at the ASP.NET Personal Web Site Starter Kit It has a mechanism that implement a random picture on the first page but the pages are stored in sql database.
Happy coding

The best way I can think of to do this is on the button upload click event, store the file to the server folder. At the same time assign a Session variable the name of the file uploaded.
You will need to manage file names that get stored on the server or check if they already exist, or if different users upload the same file name, etc.
So Session("myImage") = currFileUploaded
Then do a Redirect back to the current page to show the image, which will link to the session variable that just stored the file name that was uploaded.
You'll need to check for a post back and hide or show the image as necessary.

Related

Wordpress images no longer have srcset and are showing pixalated images

I just recently moved my wordpress site to another host. There were too many images to import so I imported them through ftp and then used the [Add from Server plugin][1] to ensure my image id and such were in the database.
Images on my new site now show up however they are very pixalated and blurry as they are showing a small image blown up to 100%. I have tried regenerating thumbnails but have had no luck. It is the saem theme with the same code.
My old site image look like this:
Where my new site looks like this:
The images are all in the media library and i I swap them in one by one it wokrs but there are hundreds of posts. Is there a way to get this to work manually somehow? I thought this is what Regenerate Thumbnails was supposed to do. thanks for any help you can give.
I just check and my excerpts are not showing either.
If I understood correctly, you uploaded images via FTP. I assume folder structure is intact - year/month folder structure inside uploads folder. That should work without any other actions. Did you try? I don't understand part where you say "to ensure my image id and such were in the database". If you take your old database and upload to your new server, then why should some ids change? :/
What I want to say is that migrating WP from one host to another is just - copy all files, copy database and that's it. If you are changing domain of the site, then you must search/replace database also (but I don't think that's the case here).

optimize and best practice for image call each time

I have client code for large project, their logo is on master page, which he updates weekly.
I have to update the title, image path, etc. on all the server and also upload a new image on all servers, now he wants to automate this process.
What is the best way to accomplish this? I have thought about storing the information (including Image) in database with single record and each time client update this single record when they want. But on each page, the logo image will come from database. Is it ok or should we cache or some other option to reduce load each time? Can we update page(.aspx) file using filestream like we can update text file? because if I update aspx from code then we don't have call any SQL, just upload an image, update the title and other information in aspx page.
Very simple. If the client wants to update something on their own without requiring developer intervention, it needs to go in the database. You can of course add any caching or whatever you like so that it's not necessary to query the database each request.
The only other viable alternative would be giving the client access to the directory that has the logo and insist on a convention for the logo filename. The client can then simply upload a new logo with the same filename and nothing needs to change on the site.
Making changes to the page itself automatically is a hugely bad idea. Avoid that like the plague.
I suppose a final though not bloody likely option is to get the client to realize that a logo shouldn't freaking be changed weekly or even yearly. It's a freaking logo; it's your identifying mark to the public.

Multiple image upload with asp.net

How to upload multiple images to the web server with single button.I know there are couple of options available like flash,j query and silverlight.The problem is that there are many others things I want to do with images like upload the same image with different size (thumbnail) and want to change the image file name something like a GUID and want to store the path in database.
You can use uploadify.js for the same.
It is light weight as it contains jquery code.
Easy to implement.
Here is the link for the same. Uploadify

FormView Image control

Hi i am currently working in Asp.net using C# language.
Please any one tell me how to show picture that are stored server table(data type image) in asp:image control.
thanks.
You'll have to save the image in some folder on your website, and use a URL to link to that image. Since this is going to be done for every request, I'm guessing you can understand this is not a best practice.
The correct way to do this is save all images in a single directory on your website, and in the DB only store the URL for that image.

Uploading private files?

I want to be able to upload files using django-cms, and have those files only be visible to authenticated users.
I've gotten as far as creating a "Members only" page, clicking "Login required" and selecting "for logged in users only" for Menu visibility ("advanced settings under /admin/cms/page). This gets me some of what I want; the page itself is not visible unless you're logged in. And the menu item goes away too.
But, the next step is a problem. I can upload a file using the "file" plugin. This puts the file under /media/cms_page_media/. Even though you can't see the page which displays the link, you can still get to the file if you have the direct URL to it. What I need is something which not only protects the page, but the files uploaded to it.
I know my way around most (well, some) of django, so I could do a bit of hacking to get a solution. I'm hoping to avoid writing an entire file manager from scratch (not that it wouldn't make a nice little OSS project).
Django Filer (https://github.com/stefanfoulis/django-filer) has this option in the newest release. It also has a nice set of CMS Plugins which add a lot of value over the default File plugin: https://github.com/stefanfoulis/cmsplugin-filer

Resources