Page 1 of 1

File Parsing For Dummies

Posted: Thu Nov 10, 2005 7:47 pm
by PnHoPob
Sorry for posting two topics, but I thought the other one looked pretty full.
I had been trying to do this project of mine in javascript but noticed its limitations, so I switched to PHP.

All right, here's the problem:
Whatever I try to do, I cannot get file parsing to work!! I need to save the contents of a file (say, example.txt) and save it into $form_namedestn. Here's what I got so far:

Code: Select all

if (is_uploaded_file($_FILES['form_name']['tmp_name']) || isset($_POST['form_namedestn'])){
    $dir="/myserver/uploadedfiles";
    $thisform_namename = $uid."_".$_FILES['form_name']['name'];
    $tempfilename = $_FILES['form_name']['tmp_name'];

    move_uploaded_file($tempfilename, $dir.'/'.$thisform_namename);

    $thisform_namename = $_FILES['form_name']['name'];
    $form_namedestn = $_POST['form_namedestn'];

echo $form_namedestn;
I've got a CHMOD 777 on /uploadedfiles and

Code: Select all

<form action="code_above.php" method="POST" name="form_name" enctype="multipart/form-data">
      <input name="form_namedesc" type="file">
      <br>
      <input name="ffile" type="submit" id="form_name" value="Submit File">
</form>
When I try to run it all, I get nothing: blank page.

Posted: Fri Nov 11, 2005 3:51 am
by Grim...
Anything in your error log?

Posted: Sat Nov 12, 2005 11:34 pm
by PnHoPob
got it... on the code above, I forgot to close my If :)

However, I was wondering:
Once I get a file into its tmp location, can I save it to a string from there (like, without putting it on my server?)