Got an image uploader that refuses to send anything and just gives me an error. Here is the uploader code:
Code: Select all
$uploaddir='submissions';
//set the naming scheme
$uploadfile=$uploaddir . $_FILES['file']['name'];
//Upload each file
echo '<pre>';
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.";
} else {
echo "Possible file upload attack!";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";Code: Select all
<form enctype="multipart/form-data" action="';$_SERVER['PHP_SELF'];echo '" method="post">
<fieldset>
<legend>Submission</legend>
<div class="information">
<h4>Information</h4>
<p>If you want to submit your work under a name other than your own, put that name in the Pseudonym field. Otherwise we will use whatever name you used to register in our system (As shown above).</p>
</div>
<label for="title">Submission Title</label>
<input name="title" id="title" type="text" class="sminp" value="'; if(isset($_POST['title'])) echo $_POST['title']; echo'" tabindex="1" /><br />
<label for="pseudonym">Pseudonym</label>
<input name="pseudonym" id="pseudonym" class="sminp" type="text" value="'; if(isset($_POST['pseudonym'])) echo $_POST['pseudonym']; echo'" tabindex="2" /><br />
<label for="text">Article</label>
<textarea cols="5" rows="8" name="text" id="text" tabindex="3">'; if(isset($_POST['text'])) echo $_POST['text']; echo'</textarea>
</fieldset>
<fieldset>
<legend>File Uploads</legend>
<div class="information">
<h4>Information</h4>
<p>You can only upload files that are less than 2MB in size. If you have more than 3 items you want to upload, or your file is more than 2MB, <a href="http://condor.depaul.edu/~slytinen/instructions/zip.html">make a zip file</a> out of them. Still too large? <a href="mailto:online@reakt.com.au">Email them</a> to us.</p>
</div>
<label for="file1">File 1</label>
<input type="hidden" name="MAX_FILE_SIZE" value="2097152" />
<input name="file1" id="file1" class="inputbox" type="file" tabindex="4" /><br />
<label for="file2">File 2</label>
<input name="file2" id="file2" class="inputbox" type="file" tabindex="5" /><br />
<label for="file3">File 3</label>
<input name="file3" id="file3" class="inputbox" type="file" tabindex="6" /><br />
</fieldset>
<label></label><input name="submit" type="submit" value="Submit" class="sminp" tabindex="7" />
</form>Code: Select all
Possible file upload attack!Here is some more debugging info:Array
(
[file1] => Array
(
[name] => 10223-b.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpxQHgfT
[error] => 0
[size] => 58382
)
[file2] => Array
(
[name] =>
[type] =>
[tmp_name] =>
[error] => 4
[size] => 0
)
[file3] => Array
(
[name] =>
[type] =>
[tmp_name] =>
[error] => 4
[size] => 0
)
)Cheers
~Chris