LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-22-2008, 02:15 PM   #1
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Rep: Reputation: 30
retain filename passed


Hi all,

I have just developed a simple application with perl + CGI

Everything works fine as expected.

Its an application to load a file, process and return it back.

But there is a lack of nice to have feature.

Using file upload I upload the file and the file name is erased from the textbox. I just want to retain that as such the same way as how *any text* would be retained if typed in a text box.

Reason for this request is, since am testing I don't have to click browse and then execute each time. If the filename is retained as such then it would be easier for me to use that filename.

Any pointers ?

Thanks
 
Old 05-23-2008, 08:46 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 448Reputation: 448Reputation: 448Reputation: 448Reputation: 448
Hi

You can't set the filename in a file upload field. The problem is that if you could, it would be very easy to include for example /etc/passwd on a page, hide it, or make it hard to see. It would be a big security problem.

For testing, while not just click reload page? It will ask you if you want to send POST data again, and you just click ok.
 
Old 05-23-2008, 10:05 AM   #3
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Original Poster
Rep: Reputation: 30
Thanks for your reply.

Correct me if am wrong.

Are you saying given a filename it should fetch the file from server ?

I didn't mean that.

Its about specifying a file and uploading that, so in that case why would that be a security threat at all.

Could you please explain that ?
 
Old 05-23-2008, 11:04 AM   #4
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 448Reputation: 448Reputation: 448Reputation: 448Reputation: 448
Hi

No, if you could set the filename, the server could get any file from the client, and that's no better.

Let's say I make a form for login. Two fields for username and password, and a submit button. Below them, I write <br> 1000 times then something like
<input type="file" name="uploadfile" value="/etc/passwd">

If the client did send the file when the submit button is clicked, there would be a problem. So you can't specify the file in the file upload field.
 
Old 05-23-2008, 09:55 PM   #5
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Original Poster
Rep: Reputation: 30
I see that. There is definitely a security hole. Thanks much for the clarification.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert static library (Filename.a) to dynamic shared object (filename.so) afx2029 Linux - Software 4 08-17-2007 06:07 AM
Using C API; first query passed passed by program to MySQL is successful, second quer weibullguy Programming 2 06-12-2007 10:45 PM
Retain old status raylhm LQ Suggestions & Feedback 9 11-15-2006 12:28 PM
change uploaded files from filename.avi to filename.avi.html like www.rapidshare.de latheesan Linux - Newbie 3 06-16-2005 04:33 AM
filename- and filename~ files? slinky2004 Linux - Newbie 5 10-17-2004 10:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration