I have written code for image uploading, when i upload image then text in other controls gets cleared, whole page get refreshed , then how to prevent this whole page refreshing in javascript or html.

6 Years
Discussion Span
Last Post by ArtistScope

Without seeing the code used it's difficult to know whether you are uploading the image separately or as you submit the whole form.

If submitting the image with the other form fields, and staying on the same page to provide a preview, then yes the form will need to refresh, but to maintain the data in other fields, simply seed them from the request form, for example specify their value like...

<input type="text" name="name" value="<%= request("Name") %>">

Uploading images usually involves using enctype="multipart/form-data" which complicates field retrieval, in which case you can use...

<input type="text" name="name" value="<%= strUploadName %>">

after retrieving strUploadName, and how you do this will vary according to which component you used for the image upload. Personally, I prefer not to use components for things as simple as image upload, and instead use a Classic ASP function that can be modified at will.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.