Would someone be able to tell the easiest way to upload an image file to a server?
Are you using AJAX to upload the file, or a regular form that submits to an ASP page?
There is a ninja technique in order to do this, it is not intuitive. I won't get into it unless necessary.
The "action" attribute tells the form where to upload the file to. The "enctype" attribute can be used to upload a file by putting "multipart/form-data" as the value. Example:
Change "/path/to/file.aspx" to your asp program that uploads files. You can put other data in this form, too- not just files. I don't know how to actually write the ASP code for uploading but I'm sure googling "ASP.net upload file" will tell you everything you need, including repeating what I just said about the form.
<form method="post" action="/path/to/file.aspx" enctype="multipart/form-data">
<input type="file" name="file">
files are not a post param, they are in a different collection.
Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)