How to store the Image on BLOB and the URL of the Image in mssql database
-
19 April 2012 11:20
I have created an application in asp.net. Here I am allowing the User to store images. I want to store the Images in a BLOB and want to get the URL of the image and store it in the Ms Sql Database table.
I have written the Code to get the Container. The only thing that remains now is to add the Images....
What should I do ahead??? Please help!!!
Thank you.
Semua Balasan
-
19 April 2012 11:41Moderator
I have a couple simple code samples for upload block blobs that should get that part one.
That said, make sure the container's access policy has been set to public read (I really should do a quick code sample on setting this programatically) and you can quickly generate the full URI to view the image via a browser. You can get the base URI from the BlobClient then just append the container and blob names with the appropriate slashes between and you're all set.
- Ditandai sebagai Jawaban oleh Shivanand Arur 19 April 2012 12:16
-
20 April 2012 11:56
Hello Brent, I am getting an error in the Code "One of the request inputs is out of range." Can you help me to solve this issue.... I read one article where it was written, if we give names to a Container in Uppercase or if there is any Uppercase alphabet in the name, then this exception is thrown.... (This is what I understood).... May be I'm wrong... But I changed the name with all lower case alphabets... But still I'm getting the same error....
Please Help...
Thanks!!!
-
01 Mei 2012 12:41ModeratorSorry for the delay in getting back to your Shivanand, do you have any special characters in the name? What may help is only temporarially use a short and simple name. Anther option is to fire up fiddler or look at using Storage Analytics to further diagnosis exactly why the request is failling.
-
02 Mei 2012 7:55
Hello Brent, I have solved the issue. The Account name in the cscfg file was in Upper case. I simply changed it to lower case and now the app is working fine.
I have got one more issue, when I dynamically add an image in the BLOB. I am getting the URI, but when I copy the URI and check it in my browser, it gives me an error like this
This XML file does not appear to have any style information associated with it. The document tree is shown below.<Error><Code>ResourceNotFound</Code><Message>The specified resource does not exist. RequestId:bf2b08cc-54fb-4a24-a045-c008c0164ffe Time:2012-05-02T07:53:56.8774477Z</Message></Error>
I don't know, why this is happening, so please help...
-
02 Mei 2012 10:07
Can you please shre the Format of the URI.
Thanks,
Brij
-
02 Mei 2012 10:17
This is the URI
http://smart*******.blob.core.windows.net/sm***websiteimages/mumbai
-
02 Mei 2012 13:29Moderator
First thing I would do is make sure the container's access policy is set to allow public read.- Ditandai sebagai Jawaban oleh Shivanand Arur 03 Mei 2012 7:21
-
03 Mei 2012 7:25
Hey Brent, Thank's a lot, Earlier I had kept the Public Access Type to "OFF" and now I simply changed it to "Blob". I also deleted the old container since I thought the Container might have got corrupt and I re-created it. So now the entire module is working fine....
Once again, Thank you very much for the help.... :)