This is a discussion on "Working with Form 'file field' data in ASP." within the Classic ASP section. This forum, and the thread "Working with Form 'file field' data in ASP. are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Working with Form 'file field' data in ASP.
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Working with Form 'file field' data in ASP.
I am relatively new to ASp and I'm sure this is a simple problem and I'm just missing something simple.
---------------------- BACKGROUND: I have got a form, with a few text fields and 3 'file fields' used to upload images.(this works fine) All I want to do is get the value of each of the 'file fields'. ---------------------- MY QUESTION: How do you get the value of a 'file field'? |
|
#2
|
|||
|
|||
|
Re: Working with Form 'file field' data in ASP.
Could this worK?
If I used the javascript below to get the value of the form field? I could run it on page unload. <script type="text/javascript"> var obj = document.getElementById('filefield1'); </script> Just thinking, it probably wont work but I will look into it. |
|
#3
|
|||
|
|||
|
Re: Working with Form 'file field' data in ASP.
Quote:
you can simly call the forum field -
|
|
#4
|
|||
|
|||
|
Re: Working with Form 'file field' data in ASP.
Actually you cant just call it. It does not work for file upload fields.
It works for all other form fields, but not for file upload fields. The solution: 1.Put this javascript in the head. <script language="JavaScript"><!-- function getExtension(value) { return value.substring(value.lastIndexOf() + 1,value.length); } //--></script> 2.Put this 'onclick' script on the forms submit button. <input name="submit" type="submit" value="Submit" onClick="document.MyForm.input1.value =(getExtension(this.form.FILE1.value));"/> 3.You also need a hidded field called in this case, 'input1' How it works: When the submit button is clicked, using the javascript function it takes the file field data and inserts it into a pre created hidden form field which you can then reference by name. I could then tell which image upload fields were empty and then alter the path information after the image upload but before the path was entered into the database. |
![]() |
| Tags |
| working, form, file, field, data, asp |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Links in a txt file not showing in dynamic text field | Darren600 | Flash & Multimedia Forum | 8 | May 9th, 2007 16:48 |
| Creating A new Data BAse from .txt file | JamieH | Databases | 3 | Jan 29th, 2006 00:26 |
| file field in ASP page | lameneural | Classic ASP | 18 | Dec 8th, 2005 12:46 |
| Add a form field | csa | Web Page Design | 8 | Nov 23rd, 2005 21:33 |
| File Field issue! | SimpleGuy | Classic ASP | 4 | May 16th, 2005 18:59 |