prak Posted April 16, 2017 Share Posted April 16, 2017 Hello, I want to upload an image from the backoffice, into a folder named uploads in the root directory of the module. Here is my code: <form action="/modules/customizeproducts/upload.php" enctype="multipart/form-data" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="30000" /> Send this file: <input name="userfile" type="file" /> <input type="submit" value="Send File" /> </form> my upload.php file: $uploaddir = 'uploads/'; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile); echo '<pre>'; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "Possible file upload attack!\n"; } echo 'Here is some more debugging info:'; print_r($_FILES); print "</pre>"; Help would be greatly appreciated!!!! Link to comment Share on other sites More sharing options...
prak Posted April 17, 2017 Author Share Posted April 17, 2017 Turns out that it was a size issue that prevented me from uploading some images. I increased the maximum size and removed the "move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile);" from above the echo function. It was causing the error message to display always. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now