File Parsing For Dummies

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
PnHoPob
Forum Newbie
Posts: 16
Joined: Thu Nov 10, 2005 7:16 pm

File Parsing For Dummies

Post 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.
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

Anything in your error log?
PnHoPob
Forum Newbie
Posts: 16
Joined: Thu Nov 10, 2005 7:16 pm

Post 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?)
Post Reply