0

how can i upload image in a channel using simple html form and create a new entry for every individual entry in channel.

i can't use channel form due to some issues so i have to upload it with simple html form

channel API can used for this.

any Idea how to do it.

  • Just to get a better idea of your requirements, what are the specific reasons why channel form won't work for you? – positlux Jun 4 '14 at 7:50
  • when i am uploading a image its show error "The form you submitted contained the following errors Decryption of form settings failed." – user3440483 Jun 4 '14 at 7:52
  • Hmm, I see you posted about that issue earlier and didn't get any response. I'm not sure how to correct that error either, although it seems like it may be a server configuration issue. I'll post an answer with some possible solutions without using channel form, but ideally you should try to figure out to get rid of that error because it might affect other parts of your site later on down the line. You might also want to try ellislab's official support if you can't get an answer here: ellislab.com/support – positlux Jun 4 '14 at 8:04
1

You ideally should figure out a solution to the channel form error you are receiving, but as a possible workaround you will need to create your own add-on to do this.

This is usually best achieved with a module that makes use of ACTions to post your form submission, but as there might be issues with this given the fact that channel forms aren't working properly you might need to do this with a plugin instead.

As an example of a plugin that can do this, you would have as your form code:

<form action="upload_image" method="post">
   <input type="text" name="title">
   <input type="file" name="file">
   <input type="hidden" name="XID" value="{xid_hash}">
   <input type="submit" value="submit">
</form>

You would then create another template named "upload_image" which contains your plugin tag, something like {exp:file_upload} or whatever you choose to name your plugin.

Your actual plugin then would grab the input data using the EE Input Class for processing the posted data. You would then pass these stored variables to the EE Channel Entries API to create the actual entry. As file uploads can be sources of security breaches, you will want to do some php-based sanitization on the file uploads to make sure they are safe to store in your database and then subsequently be output in your site. To do this, you may want to try using the EE Upload Class which has some built-in security checks.

If you need help getting started with basic plugin structures, you should try making your own 'hello world' plugin by following the developer docs step by step here:

http://ellislab.com/expressionengine/user-guide/development/plugins.html

Once you understand the basics and can get your first plugin working, then you can apply the input class and upload class and channel entries API stuff to create your file upload plugin.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.