file upload/browse
-
I placed some php code on a template page so it has a file upload function, it calls upload.php so I can upload any file I want to an upload directory, the script works outside of wordpress, but not within a wordpress page. any ideas? code is listed below. Like I said it is basic and works correctly on its very own PHP page, but I would like a page within wordpress for this… and someday beable to browse where I want to upload the file to, but one step at a time… function like “PHP Advanced Transfer Manager” within word press would be the gold… http://phpATM.free.fr
the script I placed in the page is:
<form action=”upload.php” method=”post” ENCTYPE=”multipart/form-data”>
File: <input type=”file” name=”file” size=”30″> <input type=”submit” value=”Upload!”>
</form>and my code for upload.php is
<?php
// ==============
// Configuration
// ==============
$uploaddir = “upload”; // Where you want the files to upload to – Important: Make sure this folders permissions is 0777!
// ==============
// Upload Part
// ==============
if(is_uploaded_file($_FILES[‘file’][‘tmp_name’]))
{
move_uploaded_file($_FILES[‘file’][‘tmp_name’],$uploaddir.’/’.$_FILES[‘file’][‘name’]);
}
print “Your file has been uploaded successfully! Yay!”;
?>
- The topic ‘file upload/browse’ is closed to new replies.