problm while uploading an image !!
ankit428
Registered Users Posts: 1 Beginner grinner
hey guys...
I am using the smugmug api in my application which involves
uploading and downloading images from smugmug.
I am able to download the images but when it comes to
uploading my
images, i experience the problem.. !!
Heres the snippet of my function :-
/*
String restURL="http://upload.smugmug.com/"+filename;
��� ��� System.out.println(restURL);
��� ��� URL url = new URL(restURL);
��� ��� HttpURLConnection conn =
(HttpURLConnection)url.openConnection();
��� ��� conn.setRequestMethod("PUT");
��� ���
��� ��� InputStream in=getHttpRequest().getInputStream();
��� ��� String md5=calc_md5();
��� ���
��� ��� System.out.println("THe md5 is "+md5);
��� ���
conn.setRequestProperty("Content-Length",""+inputStreamLength);
��� ��� conn.setRequestProperty("Content-MD5",md5);
��� ���
conn.setRequestProperty("X-Smug-SessionID",getSessionId());
��� ��� conn.setRequestProperty("X-Smug-Version","1.1.1");
��� ��� conn.setRequestProperty("X-Smug-ResponseType","REST");
��� ��� conn.setRequestProperty("X-Smug-AlbumID",getAlbumId());
��� ��� conn.setDoOutput(true);
��� ��� conn.connect();
��� ���
*/when i read from the response stream i get the following
message :-
<?xml version="1.0" encoding="utf-8"?>
<rsp stat="fail">
� <method>smugmug.images.upload</method>
� <err code="4" msg="wrong format (ByteCount given: 99367,
received:
99367.� MD5Sum given: 10196574cb21397849110265aba70abf, actual:
10196574cb21397849110265aba70abf.)"/>
</rsp>
It doesnot make sense to me...I am puzzled as to what the error
might be,...
Please help me resolve this issue, asap.. !!
I am stuck !!!
I am using the smugmug api in my application which involves
uploading and downloading images from smugmug.
I am able to download the images but when it comes to
uploading my
images, i experience the problem.. !!
Heres the snippet of my function :-
/*
String restURL="http://upload.smugmug.com/"+filename;
��� ��� System.out.println(restURL);
��� ��� URL url = new URL(restURL);
��� ��� HttpURLConnection conn =
(HttpURLConnection)url.openConnection();
��� ��� conn.setRequestMethod("PUT");
��� ���
��� ��� InputStream in=getHttpRequest().getInputStream();
��� ��� String md5=calc_md5();
��� ���
��� ��� System.out.println("THe md5 is "+md5);
��� ���
conn.setRequestProperty("Content-Length",""+inputStreamLength);
��� ��� conn.setRequestProperty("Content-MD5",md5);
��� ���
conn.setRequestProperty("X-Smug-SessionID",getSessionId());
��� ��� conn.setRequestProperty("X-Smug-Version","1.1.1");
��� ��� conn.setRequestProperty("X-Smug-ResponseType","REST");
��� ��� conn.setRequestProperty("X-Smug-AlbumID",getAlbumId());
��� ��� conn.setDoOutput(true);
��� ��� conn.connect();
��� ���
*/when i read from the response stream i get the following
message :-
<?xml version="1.0" encoding="utf-8"?>
<rsp stat="fail">
� <method>smugmug.images.upload</method>
� <err code="4" msg="wrong format (ByteCount given: 99367,
received:
99367.� MD5Sum given: 10196574cb21397849110265aba70abf, actual:
10196574cb21397849110265aba70abf.)"/>
</rsp>
It doesnot make sense to me...I am puzzled as to what the error
might be,...
Please help me resolve this issue, asap.. !!
I am stuck !!!
0