Jump to content

PDF Upload Issue


phpretard

Recommended Posts

I am trying to upload a pdf to my DB.

 

This is all I get...

 

Warning: fread(): supplied argument is not a valid stream resource

 


//HERE'S THE FORM

<form method="POST" action="process.php" enctype="multipart/form-data" style="width: 200"> 

Doc Name: 
<input type="text" name="form_description" size="40"> 
<input type="hidden" name="MAX_FILE_SIZE" value="256000"> 
File to upload: 
<input type="file" name="form_data" size="40"><br>
<input type="submit" name="submit" value="submit"> 
</form>

//HERE'S THE UPLOAD SCRIPT

$data = addslashes(fread(fopen($form_data, "r"), filesize($form_data))); 

$result=MYSQL_QUERY("INSERT INTO members (description, data,filename,filesize,filetype, date) 

VALUES ('$form_description','$data','$form_data_name','$form_data_size','$form_data_type', '$date')");

$id= mysql_insert_id(); 

print "<p>File ID: <b>$id</b><br>"; 
print "<p>File Name: <b>$form_data_name</b><br>";
print "<p>File Subject: <b>$Subject</b><p>"; 
print "<p>File Size: <b>$form_data_size</b><br>"; 
print "<p>File Type: <b>$form_data_type</b><p>"; 

 

Any help tonight please??

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.