0

I presumed that when I use ovh object storage ('similar' to AWS s3, but based on openstack swift) I can upload an jpg-image, then (as my container is 'public') I could just reference it from html like:

<img src="'https:pathtomycontainer/myTestImage.jpg'"> 

and everybody would be happy. However when I upload a file to my ovh container I can see it via the horizon terminal and it has the right name and has the same filesize as myTestImage.jpg, but the img-element reference does not work as it 'should'. Furthermore when I download myTestImage.jpg from the ovh container to my local disk, I can not open it as it appears not to be a valid jpg. What's going on?

My ideas so far is that myTestImage.jpg is actually not a jpg but an application/x-www-form-urlencoded file..., but how do I proceed?

And my question is: how can I get myTestImage.jpg into the storage and easily reference it from (preferably a img-) html element?

These are the details of the object (here 'myTestImage.jpg' is called 'myfile.jpg'):enter image description here

I uploaded the file with this uploader, but get similar results when doing this curl:

curl -X PUT --data @./222.jpg -H "X-Auth-Token: mysecretovhtoken" https://storage.gra1.cloud.ovh.net/v1/AUTH_myserviceID/containername/myfile.jpg 

EDIT: The actual file is 4.9Mb. When I upload with the curl this becomes 1.8Mb (and it stays 1.8Mb when downloaded again). When using the QUploader it shows a size of 4.66Mb, when I download the file however it becomes 4.9Mb (so probably gzipped on the server?!). When I try to open it I get this message (sorry it has a different name, but handling is the same): enter image description here

musicformellons
  • 12,283
  • 4
  • 51
  • 86

1 Answers1

1

did you try

curl --file-upload ./222.jpg -H "X-Auth-Token: mysecretovhtoken" https://storage.gra1.cloud.ovh.net/v1/AUTH_myserviceID/containername/myfile.jpg

you may then check the difference between the above curl request and your upload procedures ...

Axel Amthor
  • 10,980
  • 1
  • 25
  • 44
  • I get ```curl: option --file-upload: is unknown curl: try 'curl --help' or 'curl --manual' for more information```. Tried also with -X PUT after curl but get same error. – musicformellons Feb 14 '18 at 21:13
  • Aaah, it should be --upload-file instead of --file-upload (edited your answer) and then it works, i.e. it uploads the file (again shows size 4.66Mb), when I subsequently download the file it is 4.9Mb again and I can open it as a picture! The content-type is ```image/jpeg``` instead of ```application/x-www-form-urlencoded```. When using the QUploader the content-type is ```multipart/form-data; boundary=----WebKitFormBoundaryF2x0ucXd0d6posW3```. Maybe I need to change that somehow?! – musicformellons Feb 14 '18 at 22:19
  • Mmmh, seems to relate to [this issue](https://github.com/quasarframework/quasar/issues/1133). Will look into this further. – musicformellons Feb 14 '18 at 22:26
  • Yeah, after implementing the commits related to the issue it also works for QUploader, I can download the file and open it as a picture, yihaaa! – musicformellons Feb 14 '18 at 22:37