Skip to content

Instantly share code, notes, and snippets.

@ryanstrandt
Forked from twinge/gist:21533
Created November 2, 2008 20:24
Show Gist options
  • Save ryanstrandt/21742 to your computer and use it in GitHub Desktop.
Save ryanstrandt/21742 to your computer and use it in GitHub Desktop.
<?php
if (isset($_POST["PHPSESSID"])) {
session_id($_POST["PHPSESSID"]);
}
session_start();
if (!isset($_FILES["Filedata"]) || !is_uploaded_file($_FILES["Filedata"]["tmp_name"]) || $_FILES["Filedata"]["error"] != 0) {
// Usually we'll only get an invalid upload if our PHP.INI upload sizes are smaller than the size of the file we allowed
// to be uploaded.
header("HTTP/1.1 500 File Upload Error");
if (isset($_FILES["Filedata"])) {
echo $_FILES["Filedata"]["error"];
}
exit(0);
}
//$currentdir = getcwd();
$uploads_dir = '/home/17240/domains/indycc.org/html/upload_test/files/';
$tmp_name = $_FILES["Filedata"]["tmp_name"];
$name = $FILES["Filedata"]["name"];
if (isset($_FILES["Filedata"]) && is_uploaded_file($_FILES["Filedata"]["tmp_name"])) {
move_uploaded_file ( $tmp_name, "$uploads_dir/$name"); // . $_POST['target_directory'] );
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>SWFUpload v2.0 Multi-Upload Demo</title>
</head>
<body>
<p>Upload Page</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment