Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: PHP to Perl ?

by Sinistral (Prior)
on Sep 10, 2012 at 16:29 UTC ( #992794=note: print w/ replies, xml ) Need Help??


in reply to Re: PHP to Perl ?
in thread PHP to Perl ?

Actually, the snippet makes a lot of sense when you know it's PHP. The $_FILES superglobal is created when a form element to a submitted PHP page contains a file upload. The translation of:

$tmp_file_name = $_FILES['Filedata']['tmp_name'];

is "Retrieve the temporary file name PHP created (the tmp_name) of the form element Filedata and put it in the string tmp_file_name

The next line:

$ok = move_uploaded_file($tmp_file_name, '/path_to/new_filename');

makes use of the PHP move_uploaded_file function (hence the OP can't show the source - you're asking for PHP's own source). That function takes the uploaded file and moves it to a directory specified by the second parameter.

The Perl way to do this is best outlined (as Anonymous Monk already posted) in CGI - Processing a File Upload Field. The field name is Filedata, and from that you should be able to determine the rest.


Comment on Re^2: PHP to Perl ?
Select or Download Code
Re^3: PHP to Perl ?
by PriNet (Beadle) on Sep 12, 2012 at 03:02 UTC
    Actually... thank you for this, it helps a because I have not dealt with php, and it helps me to understand more of what the php script is expecting. I'm going to spend alot of time studying the article you mentioned that anonymous monk has provided. At first look, I'm having trouble figuring out how I'm going to incorporate the $_FILES['Filedata']['tmp_name'] into anonymous monk's $lightweight_fh  = $q->upload('field_name'), but I understand most of the rest of it. I guess, *heh*, wish me luck, php is not my forte'.

    So there's a harder way?
    I need to try that !

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992794]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (13)
As of 2014-10-01 15:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (29 votes), past polls