Search code examples
javascripthtmlamazon-s3ecmascript-6ovh

file format changes when uploading to storage server


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


Solution

  • 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 ...