The online racing simulator
[PHP] Excel file upload
(2 posts, started )
[PHP] Excel file upload
Hey lads,

I'm having a bit of trouble uploading an Excel (.xls) file to my webserver via a form on my site.
This is a sample script i copied from some tutorial. I just need to be able to upload a files to a directory.
Nothing too complicated, no need for file validation or any security.

Here is the HTML code i'm using:

<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>

Here is the PHP code:

<?php 
// Where the file is going to be placed 
$target_path "uploads/";

/* Add the original filename to our target path.  
Result is "uploads/filename.extension" */
$target_path $target_path basename$_FILES['uploadedfile']['name']); 
$_FILES['uploadedfile']['tmp_name']; 
?>

It will upload most file types. I've tried it with word (.doc), jpeg, gif and they all work fine. For some reason Excel files wont upload....

P.S. i know this is an very un-secure script. I'm not worried about that as it is only accessible to admins how have been approved by me.
#2 - Ian.H
Hi niki..

Drop me a PM with an e-mail addy in and I'll send you a PHP class I wrote a few years back to upload files if interested



Regards,

Ian

[PHP] Excel file upload
(2 posts, started )
FGED GREDG RDFGDR GSFDG