?
Solved

upload a file and return HTML

Posted on 2003-03-08
15
Medium Priority
?
145 Views
Last Modified: 2010-03-05
I have an HTML Form that will let a user browse to a file on the their PC - I want to be able to use a Perl script to upload the file to a folder in the htdocs directory or to that directory it self and then return an HTML page with a confirmation message that the file was uploaded sucessfully can someone provide an example on how to do that?

Thanx
0
Comment
Question by:mapper
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 3
  • +1
15 Comments
 
LVL 8

Expert Comment

by:jhurst
ID: 8096674
just use the <input type="file"> and make sure that the method="post" and the enctype are set in the <form> and the contents of the file will be passed to your perl script.
0
 
LVL 8

Expert Comment

by:jhurst
ID: 8096721
just use the <input type="file"> and make sure that the method="post" and the enctype are set in the <form> and the contents of the file will be passed to your perl script.
0
 

Author Comment

by:mapper
ID: 8096771
okay - but, it's the script I need help putting together - I am new to Perl and was looking for some help putting the script together - using that and a book should help me get up to speed faster...

I was looking for help with the script to do what I wanted to do
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 48

Expert Comment

by:Tintin
ID: 8097032
Plenty of examples in the CGI module documentation.

perldoc CGI
0
 
LVL 8

Expert Comment

by:jhurst
ID: 8099149
As tintin says.

In fact the contants of the file will be received like any other parameter.  So, if you know enough perl to accept/read other parameters, you know enough to get the contents of the file.
0
 

Author Comment

by:mapper
ID: 8113715
Yep - you folks were right - it wasn't that hard...

How hard is it to have Perl look and see if a file has been saved with the same name prior to saving the file to the server?

0
 
LVL 8

Accepted Solution

by:
jhurst earned 200 total points
ID: 8114335
if (-e $fileName) {print "File Exists"}

And btw, if you have your answer ypu should close this.
0
 

Author Comment

by:mapper
ID: 8114372
Thanks - I don't know if there is an answer or if one was provided - some good advice to look into some places for an answer to the question - I just played with the script until it worked...

I will ask to have this question deleted then...

Thanks,
0
 

Expert Comment

by:SpideyMod
ID: 8115152
A request for refund has been made.  Experts you have 72 hours to object or I intend to grant the request.

SpideyMod
Community Support Moderator @Experts Exchange
0
 

Author Comment

by:mapper
ID: 8115186
Yes, if some has a pair of bunched up undies - I can be persuaded to award points based on a decent rationale - I didn't get anything from this session that was worth any points...  I am open to discussion though...
0
 
LVL 8

Expert Comment

by:jhurst
ID: 8118213
I hope that someone gets the points.  Don't really need them myself but at the same time I do believe that a poor precedent is set if we allow questions to be asked, comments to be made and then the question to be withdrawn.
0
 

Expert Comment

by:SpideyMod
ID: 8120553
jhurst,
I understand.  However a more specific recommendation needs to be made in order for me to be able to make a decision what to do here.  I am not an expert in this area, so I would not know whether or not any of the answers assisted and I have to rely on both the questioner and the experts to tell me whether or not something worked.  I will say this:

1) it was a 75 point question
2) mapper indicates: "okay - but, it's the script I need help putting together"
3) "check the docs" was recommended and apparantly followed
4) mapper: " I just played with the script until it worked."

mapper indicated needing a little more in the way of a small script for handling the files.  I must admit the text of the question and comments is fairly vague.  Then there seemed to be a push to close the question.


My personal recommendation would be to:
1) reduce the points for this question to a lower point value, perhaps to the value of an "easy" question which is 50.
2) accept a comment from jhurst.

Note: lowering the points for a question is not something we do frequently, but my personal feelings are that an "easy" answer was given.

Some other options:
PAQ the question with no refund
PAQ the question with a refund
Delete with a refund
Delete with no refund
accept a comment at the 75 point value.

SpideyMod
Community Support Moderator @Experts Exchange
0
 
LVL 8

Expert Comment

by:jhurst
ID: 8121922
sounds like a GREAT solution to me.  

0
 

Author Comment

by:mapper
ID: 8122000
I don't feel any of the comments warrant points - look at the question:

"can someone provide an example on how to do that?"

I don't see any examples of code...

Do you?

I figured it out my self - delete the question no points...

0
 

Expert Comment

by:SpideyMod
ID: 8143608
mapper,
Looking this over, I can see somewhat where you state you want code so here's what I am going to do.  I will award the points to jhurst at 50 points.  I will add 25 question points back to your account, so the cost of this question was 25 points to you, jhurst gets the full 50 points for his answer and doesn't get penalized for trying to help.  This al took place over the course of 3 days and plenty of back and forth responses have been given and you say yourself that it wasn't that hard.

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question