I have a web form that requires users to fill out some information and upload an image.
What I don’t understand:
-
If I use uploadify to select a file doesn’t it upload it right away to the server? Is there a way to defer that until the user would click on a form submit button? Or at least not save it to the file system?
-
Most examples use a custom HttpHandler for uploading files, but my file upload is part of a form. Should I still use a HttpHandler for that?
Well, I’ll try to answer all your many questions, one by one. But before anything, open the official documentation because I will rely on it for answers.
If I use Uploadify to select a file doesn’t it upload it right away to the server?
As you can see on the first demo, you can have a
anchor(or abuttonor anything) to trigger the upload start. The Uploadify don’t upload nothing until it’s done (if the property auto isn’ttrue).Is there a way to defer that until the user would click on a form submit button?
Like described above, yes. And it’s the default way (since the default value of
autoisfalse).Or at least not save it to the file system?
While the button doesn’t trigger the
.uploadifyUpload()method, nothing goes to the server. But when the Uploadify starts sending, it will be handled by the server (with the HTTP Handler). The handler is the guy that save it to the file system.Most examples use a custom HttpHandler for uploading files, but my file upload is part of a form. Should I still use a HttpHandler for that?
As described on the
scriptproperty, you can point to any server-side language that will handle the HTTP Request containing the data. TheHttpHandleris the right thing because it haven’t any other processing before or after the code you write. It isn’t hard. The official forum shows some samples. And here on StackOverflow we have many questions about it, like these: Getting Uploadify Working in C# and Uploadify not working with ASP.NET WebForms.