Jump to content

Photo Upload Help


phprocker

Recommended Posts

Hey all.  On my site I have the ability for users to upload photos.  While the upload feature works, however the file is not viewable.  And, when i try to delete or rename the uploaded file, I get this error: Delete failed for untitled.bmp

-- Filenames may only contain the characters 'a-z', 'A-Z', '0-9', '-', '_', and '.' and may not start with a '.'

The file does show as 900KB so there's something there but even from within my file manager I get 403 Forbidden when I try to view the photo.

 

Here are my form page and sql page.

 

uploadpic.php

<form action="uploadpic2.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="3145728">
<p>File to upload: <input type="file" name="fileupload"></p>
<p>Max Size 3MB <input type="submit" value="Upload!"></p></form>

 

uploadpic2.php

<?php
include 'db.php';
$file_dir = "uploads";

foreach($_FILES as $file_name => $file_array) {

	if (is_uploaded_file($file_array['tmp_name'])) {
		move_uploaded_file($file_array['tmp_name'], "$file_dir/$file_array[name]") or die ("couldn't copy");
		$uploadresults = "Your File Was Uploaded!<br>An admin will review it for posting.";
		}}
print $uploadresults; ?>

 

Thanks in advance.  :)

Link to comment
https://forums.phpfreaks.com/topic/128547-photo-upload-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.