Click to See Complete Forum and Search --> : keeping data in my input tag


EyeTalion
02-06-2003, 02:09 PM
everytime my page does a postback, I lose the path to my file in my <input type=file> tag...anyone know stop this?

EyeTalion
02-07-2003, 07:41 AM
is there a way to save the path and then place it back in the tag after the postback?

Ribeyed
02-07-2003, 08:10 AM
hi,
As Dave said this is not possible because of security reasons. Why do you want to do this anyway? Many if you post the problem or the reason you need this, we can maybe suggest other solutions:D

EyeTalion
02-07-2003, 08:19 AM
well, I have a page where the user puts in data and selects a .pdf from there harddrive and then clicks save to put it in a DB. I'm doing validations on my page and some are in the code behind page usign asp.net. So if one of the edits goes off they get sent back to the page, fix the appropriate field, then click save, but now the path to the .pdf is missing and they have to selet it again...

Ribeyed
02-07-2003, 08:32 AM
hi,
ok i understand your problem, there is no way you can save the path and then preserve the file path on post back. Here is just sugestion for a work around.

If i was to do this i wouldn't store the file in the database only the file name. If i didn't want the user to have to reselect the file for uploading again then i would upload the file regardless and store the file name in the database. If the user has to reenter information you can have and if statment that looks for file name in database if one is there then just display file name if not then you know its the first time so you display the file inputbox.
In the code behind page i would also put if statment to check to see if file has already been uploaded. If it has don't upload again if the file is not there then upload.

The only problem with this is if the user cancels your left with an uneeded enter in your database and a file on your server that is not needed.
I can't think of any way around it, sorry

EyeTalion
02-07-2003, 09:11 AM
is it possible to use something like this:

strFileName = pdfUpload.PostedFile.FileName

have the name saved in a variable then when the page reloads fill in the <input> tag?

Ribeyed
02-07-2003, 12:13 PM
hi,
again no, there is absolutly no way to auto fill the file box. What you want to do is not possible, at all.