Modification in CURL request to load image in RoR

I can load an image into a RoR app (using a carrier to load images) via a CURL request,

curl -v -H 'Content-Type: multipart/form-data' \
-H 'Accept: application/json' \
-F "photo[display_photo]=@/home/Pictures/images.jpeg" \
-F "photo[name]=Flower" http://localhost:3001/photos.json

      

But I wanted to change the command above like,

curl -v -H "enctype: multipart/form-data" \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-d '{"photo":{ 
 "name":"Flower", 
 "display_photo":@"/home/Pictures/images.jpeg"
}}' POST http://localhost:3001/photos.json

      

How to achieve this !!!

+3


source to share


1 answer


The question looks incomplete. But I think what you are trying to achieve is similar to what this question is asking:

Hang request to download image from local machine to rails ruby ​​app



  • Note: Remember, when asking a question on stackoverflow or any of its variations , keep in mind another person with the same problem you are facing . Therefore, ask questions as clear as possible so that they will help you and others in the future. A few links before asking the question:
+1


source







All Articles