Safwen Posted August 30, 2013 Share Posted August 30, 2013 hi guys, i want to find the $_FILES[] values (name , size etc) of an input file field in my form it seems that Tools::getValue("image"); doesn't work when i print the result. so i have tried that var_dump($_FILES['image']); but i get nothing just an empty array. how to do that please ? thanks in advance Link to comment Share on other sites More sharing options...
Safwen Posted August 30, 2013 Author Share Posted August 30, 2013 it seems that the value of the input file is ignored by prestashop Link to comment Share on other sites More sharing options...
vekia Posted August 30, 2013 Share Posted August 30, 2013 may i know how your form looks like? you use correct form enctype? Link to comment Share on other sites More sharing options...
Safwen Posted August 30, 2013 Author Share Posted August 30, 2013 (edited) yes it is all right <form name= "myform" enctype="multipart/form-data" method="post" action="add_product.php"> Edited August 30, 2013 by Safwen (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted August 30, 2013 Share Posted August 30, 2013 that's right, it looks well. So, you've got <input type="file" name="images" /> and when you add file to it, and then - submit form you cannot get an access to the $_FILES variable this variable doesn't exist at all? can you try with var_dump($_FILES) ? can you for test purposes create other input in this form, for example: <input type="text" name="testinput" value="1" /> and then try with var_dump($_POST['testinput']); - does it work well? Link to comment Share on other sites More sharing options...
Safwen Posted August 30, 2013 Author Share Posted August 30, 2013 yes with other inputs it works well but with input type=file i get null or an empty array . I don't know why Link to comment Share on other sites More sharing options...
PascalVG Posted August 31, 2013 Share Posted August 31, 2013 Hi Safwen, A good place to start is here: http://stackoverflow.com/questions/3586919/why-would-files-be-empty-when-uploading-files-to-php Some checklists and good comments. Hope this helps, pascal Link to comment Share on other sites More sharing options...
Safwen Posted September 2, 2013 Author Share Posted September 2, 2013 (edited) i have solved that instead of that <form name= "myform" enctype="multipart/form-data" method="post" action="add_product.php"> i put that <form name="myform" id="myform" action="{$request_uri|escape:'htmlall':'UTF-8'}" method="POST" enctype="multipart/form-data"> everything is going well now Edited September 2, 2013 by Safwen (see edit history) Link to comment Share on other sites More sharing options...
PascalVG Posted September 2, 2013 Share Posted September 2, 2013 Thanks for sharing the solution! I'll mark the topic as solved, pascal 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