Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,670 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,182 people online right now. Registration is fast and FREE... Join Now!




Code for Saving and Retrieving a file has failed me

 
Reply to this topicStart new topic

Code for Saving and Retrieving a file has failed me, Being able browse, save and retrieve a scanned text

BOGHOL2
post 9 Aug, 2007 - 08:17 PM
Post #1


New D.I.C Head

*
Joined: 9 Aug, 2007
Posts: 3


My Contributions


A code is failing to upload a scanned file/document, then saving in the database and then giving an option for retrieving the saved file.



CODE



<html>
<head>
<title>A simple file upload form</title>
</head>
<body>
<form action="do_upload.php" enctype="multipart/form-data" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="51200">
<p><strong>File to Upload:</strong> <input type="file" name="fileupload"></p>
<p><input type="submit" value="upload!"></p>
</form>
</body>
</html>


<?php
$file_dir = "";
foreach($_FILES as $file_name => $file_array) {
    echo "path: ".$file_array['tmp_name']."<br>\n";
    echo "name: ".$file_array['name']."<br>\n";
    echo "type: ".$file_array['type']."<br>\n";
    echo "size: ".$file_array['size']."<br>\n";
    if (is_uploaded_file($file_array['tmp_name'])) {
        move_uploaded_file($file_array['tmp_name'],
           "$file_dir/$file_array[name]") or die ("Couldn't copy");
        echo "file was moved!<br><br>";
     }
}
?>

User is offlineProfile CardPM

Go to the top of the page

alpha02
post 9 Aug, 2007 - 11:35 PM
Post #2


D.I.C Addict

Group Icon
Joined: 20 May, 2006
Posts: 683



Dream Kudos: 850
My Contributions


If you post your code in the PHP forum we will be glad to help you. Welcome to DIC anyway smile.gif

This post has been edited by alpha02: 9 Aug, 2007 - 11:38 PM
User is offlineProfile CardPM

Go to the top of the page

Thorian
post 15 Aug, 2007 - 12:40 PM
Post #3


Pirate Medic

Group Icon
Joined: 6 Jun, 2002
Posts: 5,736



Thanked 4 times

Dream Kudos: 275
My Contributions


Since Alpha says this is PHP ill move it for ya.

Welcome anyway.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 06:01AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month