supermandru Posted October 4, 2011 Share Posted October 4, 2011 Hi, I am trying to create a module that allows users to upload image file. These images will not be attached to any products. For each picture to be uploaded I'd like to collect and store the the following configuration info: Path to file (text) Display order (number) Active/Inactive flag (1 or 0) Description(text) I am creating a back office configuration page for this module, and I have been able to render all the attributes (i.e. form fields) except the one for the image file itself. I imagine the field for uploading the file itself will be an input element of type "file" i.e. <input type="file"/>. My questions are: how do I specify (in my module's php code) a location where the file ends up in my and how do I get the path to the file location so I can store it as an attribute in the database (also within my php code) ? If anyone can point me to sample code that does this or respond with code snippets, I'd really appreciate it. Thanks. Andrew. Link to comment Share on other sites More sharing options...
dawb Posted November 28, 2011 Share Posted November 28, 2011 Hi, did you have any luck with doing this? Thanks Link to comment Share on other sites More sharing options...
luci1 Posted November 29, 2011 Share Posted November 29, 2011 Hi, If you use the move_uploaded_file function in your module to upload images you can specify the destination in the second parameter. And I advise you to store only the name of the file and not the entire path. It's the easiest way if you want to change the destinatation folder later. Link to comment Share on other sites More sharing options...
dawb Posted November 30, 2011 Share Posted November 30, 2011 Great, thanks for your help Link to comment Share on other sites More sharing options...
luci1 Posted December 1, 2011 Share Posted December 1, 2011 You're welcome. 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