Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Upload and Passing Parameters 1

Status
Not open for further replies.

clivehenderson

IS-IT--Management
Nov 2, 2002
66
GB
Hi
I'd like to be able to upload a file and pass the filename to another form so I can update a database with it.
I've found scripts that upload files OK but don't pass the filename back.
I can't use aspuploads etc with my provider.
Any help appreciated - I don't mind paying for a script that will do the job.
Thanks in advance.
Clive
 
Hi

What about hidden input ? Put in the source of the second form something like this :
Code:
<input type="hidden" name="previous_upload" value="$uploaded_filename">

Ok, you wrote that no ASP, but forget to mention what is permitted/available. If possible, you could use a session variable for this.

Feherke.
 
Thanks
I've found out that the method of post required does no allow this. However, I've got round my immediate problem by doing it in 2 stages.
1. The user inputs the filename on screen 1
2. Screen 2 actually uploads the file.
I was trying to do it all at once!
 
Hi

What is wrong with the post ? Did you specified the [tt]enctype[/tt] attribute ? The CGI must receive the filename too.
Code:
<form action="yourscript.cgi" method="post" enctype="multipart/form-data">

Feherke.
 
Hi
Sorry I was not too clear at the beginning.
Yes, the cgi will determine the filename but does not pass it back. So I was trying to get if from the fileupload form but this only uses a system number.
Kind regards
Clive

Code:
<form action="/cgi-bin/upload.cgi" method="post" enctype="multipart/form-data"> 
  <p>
    <input type="File" name="FILE1">
  <p>
    <input type="Submit" value="submit">
</form>
 
Hi

By the way, what means that "pass back" ? And you stil not mentioned what language you use. And that name must be the real name of the uploaded file, or something else ? And who gives you that system number instead of file name ?

Feherke.
 
Feherke
Sorry I forgot to thank you for your help.
Thanks
Clive
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top