Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Upload - Allow .exe files 1

Status
Not open for further replies.
May 13, 2005
56
US
Currently, I am using the following to test an upload page I am building.

Code:
<form enctype="multipart/form-data" action="test.php" method="post">
  <div align="center">
    <p> 
      Upload</p>
    <p><input name="userfile" type="file" /><br />
      <input type="submit" value="Upload" />
    </p>
  </div>
</form>

<?php
$uploaddir = '/var/[URL unfurl="true"]www/website/uploaddir/';[/URL]
$uploadfile = $uploaddir . $_FILES['userfile']['name'];


print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
    echo "The file ". basename( $_FILES['userfile']['name']). " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";
}
?>

I can sucessfully upload .zip, jpg etc files, but havent been able to allow .exe files...

Do I need to add something to allow .exe uploads?

This page is going to be in a protected area that I will be using to upload basic programs that I need when I am out at customers sites, once uploaded I will store their link in a mysql db and post it on a html page.
 
To the best of my knowledge, there is no limit in PHP to the type of file that can be uploaded to a script.

There may be, however, limits imposed by the size of a file, the amount of time a script can run, or other limits imposed by your web server.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Thanks, just ran a quick test, created a txt file on my desktop and renamed it to test.exe and was able to sucessfully upload it..

This is a server that I have built with FC4 and Apache, PHP, MySQL etc... All updated to the nexest versions.

So it appears to either be a limitation in size, or script time?

I will try setting a size limitation in the script to something high and see what happens.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top