Dawn Posted October 6, 2015 Share Posted October 6, 2015 Hi, i'm trying to put a attachment input when on the customer register. I put this code on authentication.tpl <input type="file" name="fichero"> and the uploaded code on AuthController.php if(isset($_FILES['fichero']['name'])){ move_uploaded_file($_FILES['fichero']['tmp_name'], 'path to /upload'.$_FILES['fichero']['name']);} around the line 553 if (!$customer->add()) $this->errors[] = Tools::displayError('An error occurred while creating your account.'); else { //upload code here but can't move file. Upload folder has permisions. What am doing wrong? Link to comment Share on other sites More sharing options...
cristic Posted October 7, 2015 Share Posted October 7, 2015 (edited) First of all - you should check 'path to /upload' folder permissions. Also, make sure you added enctype="multipart/form-data" in authentication.tpl, for <form id="create-account_form"> tag. By default, this doesn't exist. Edited October 7, 2015 by cristic (see edit history) Link to comment Share on other sites More sharing options...
Dawn Posted October 7, 2015 Author Share Posted October 7, 2015 Doesn't work, still doing nothing Link to comment Share on other sites More sharing options...
cristic Posted October 7, 2015 Share Posted October 7, 2015 Did you checked folder permissions? Is it writable by php owner? Try a simple test-case: <?php $myfile = fopen("path to /upload/testfile.txt", "w") or die("Unable to open test file!"); fwrite($myfile, "Test file access."); fclose($myfile); ?> Link to comment Share on other sites More sharing options...
Dawn Posted November 8, 2015 Author Share Posted November 8, 2015 Sorry for de delay but i had to take another project and can't prove what you say. As soon as return to this project i prove this code and put here the results. Thanks for answering! 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