mylesgrant.com

PHP Nokia Image Upload Server 0.2 Release

I’ve added filesystem storage capability to my Nokia Image Upload Server code, packaged it up, bumped the version number, and put it out there. This is untested, because I don’t use this method, but I’m pretty confident that it’ll work. If anyone downloads this and the filesystem storage works, please let me know.

It’s important to know that MySQL is still required for user/password storage and keeping track of galleries. You then have the choice of storing the actual image data on the filesystem or in the database, like me.

As always, this code is unsupported. The usual disclaimers apply.

We have two choices here, a 11,650 byte gzipped-tar, and a 15,184 byte zip file.

Update: There is a new version of this code available.


15 Comments

I think I’m setting the $imageUploadRoot wrong or something’s wrong with the uploading to FS function. Shouldn’t it begins with \usr\www… or \usr\home… leading all the way up to the imageUpload directory? Your example in global_php looks different!

Posted by Jeffrey Moy on 23 February 2004 @ 11am

Thanks for creating this. I have one problem:

I am trying to use this in FS mode. I reaslize you did not test this, but I am trying to make due.

There seems to be a problem with the Directory ID. When uploading, the 3650 asks me to make a new directory. (It does not see any that are created in the “gallery”)
After uploading, it says complete, but then says it was unable to upload the picture.

Debug log is below..

GET data…
POST data…
Version => 1.0
Username => user
Password => pass
Language => EN
0
Version=1.00
SId=SessionId=10783750141253918293
RSURL=http://www.site.com/remoteStorageCapabilities.php
GET data…
SessionId => 10783750141253918293
POST data…
0
CreateDirURL=http://www.site.com/createDir.php
UploadURL=http://www.site.com/upload.php
DirListURL=http://www.site.com/dirList.php
GET data…
SessionId => 10783750141253918293
POST data…
0
0
2
GET data…
SessionId => 10783750141253918293
POST data…
DirId =>
Filename => Image(02).jpg
MimeType => image/jpeg
FILES data…
name => Image(02).jpg
type => image/jpeg
tmp_name => /tmp/phphU3Ly4
error => 0
size => 59119
1
No DirId passed.

Posted by Doug on 3 March 2004 @ 8pm

I’m experiencing the exact same thing. I don’t think the script is writing to where it’s suppose to. I made new directories within “gallery” and my 3650 doesn’t see them!

Posted by Jeffrey Moy on 4 March 2004 @ 7am

Actually, I’ve tried it both ways (both SQL and FS) and I cant seem to get it to write a gallery at all.

If it create a gallery in the SQL, I DO see it when trying to upload, but even in FS mode the file gets uploaded to the SQL. Actually, It doesnt fully get uploaded, because its 0k when it gets there.

Not sure what the problem is.

I’d love to use this feature, but I’m stuck on how to get it working.. I’ve tried this script and a perl script and neither worked for me.

Posted by Doug on 4 March 2004 @ 8am

Stumbled upon this post when looking for a JSP implementation of the same thing. But I couldn’t find one, so I wrote one. In case anyone’s interesed, I put up a snapshot of the code at http://dll.nu/image_upload_040307.tgz. It doesn’t require a database (users et.c. are stored in text files) but it is a very very quick hack with all the paths hardcoded in pretty much every file. Folders are shared among all users.

Just thought I’d let anyone else stumbling upon here know. :-)

Posted by Rasmus Sten on 6 March 2004 @ 11pm

i think there is a missing ) at the end of line 22 of the createDir.php file. it is causing the script to fail, and the phone to disconnect. it is an easy fix. and will work with both FS and MYSQL.

good work btw. exactly what i was looking for.

Posted by Harper Reed on 30 March 2004 @ 2pm

That might be the problem… I decided to rewrite a large portion of it recently and haven’t finished it. I noticed a few syntax errors like that while I was rewriting, but I don’t remember if that was one.

I was making really good progress on the rewrite… and then my grandpa died, so… Might be another week or so before I finish it.

Posted by Myles on 30 March 2004 @ 2pm

Awesome. It worked! Thanks Harper for the quick fix. And sorry Myles about your grandpa.

Posted by Jeffrey Moy on 1 April 2004 @ 9am

I’ve got this script up and running. The only problem is: the directories and uploaded images all belong to user nobody, group bin and permissions set to 600. I’ve installed a PHP wrap that set the user as me but I can’t seems to change group to users and permission to 755 so that I can display them on a webpage.

Any thoughts?

Posted by Jeffrey Moy on 9 April 2004 @ 9am

Hi. can someone post the corrected line22? I don’t really know php, so I’m a bit confused. Thanks.

Posted by adam on 21 April 2004 @ 5pm

ok, i got line 22 taken care of, but now I get an error about “Unable to upload 1 images”…
Here is the tail end of my debug info where the problem seems to occur. Any suggestions? I am using FS.
[8] Undefined index: ImageData
Error in line 10 of file /home/adam/html/imageUpload/upload.php
PHP 4.2.2 (Linux)
1
No ImageData passed.

Posted by Adam on 21 April 2004 @ 6pm

Hrm. Still getting the “Unable to upload 1 images”
Any clues? Here’s what appears to be the pertinent debug info. Using FS storage, owned by apache user with +w.

Filename => Image(14).jpg
MimeType => image/jpeg
ImageData => ????
[8] Undefined index: ImageData
Error in line 10 of file /home/adam/html/imageUpload/upload.php
PHP 4.2.2 (Linux)
1
No ImageData passed.

Posted by Adam on 29 April 2004 @ 11am

Hi!
Got same ImageData problem here. When dumping data the image is sent.
T 222.22.22.222:49829 -> 111.111.111.11:80 [AP]
POST /up/imageUpload/upload.php?SessionId=1083781203683396178 HTTP/1.1..Host: yyyyyy.xxxx.lv..User-Agent: Photo Upload (7650/1.0)..Cookie:..Content-T
ype:multipart/form-data; boundary=b1i7zh1cn..Content-Length:42330….
##
T 212.93.97.132:49829 -> 159.148.115.15:80 [A]
–b1i7zh1cn..Content-Disposition: form-data; name=”DirId”..Content-Type: text/plain; charset=utf-8….22..–b1i7zh1cn..Content-Disposition: form-data
; name=”Filename”..Content-Type: text/plain; charset=utf-8….IIIC.jpg..–b1i7zh1cn..Content-Disposition: form-data; name=”MimeType”..Content-Type: t
ext/plain; charset=utf-8….image/jpeg..–b1i7zh1cn..Content-Disposition: form-data; name=”ImageData”; Filename=”IIIC.jpg”..Content-Type: image/jpeg.
……………………………………….%…#… ,!#&(***…1-(1%)*(………..(…((((((((((((((((((((((((((((((((((((((((((((((((((……….
(some ~40k binary data here)
…`…..k..

Posted by johny_ on 5 May 2004 @ 11am

…`…..k…..’..(Is\.U9.:m*…s#……..|….;t…..BK.R…..yQ)…..1..;..c…U8……….–b1i7zh1cn–..

But when I do:
ob_start();
phpinfo(INFO_VARIABLES);
error_log(ob_get_contents());
ob_clean();
The ImageData length is 4 chars. Either Apache/PHP or nokia is not following the RFC.
If somebody finds where is the problem please let me know at janis at camp dot lv.
Thanks

Posted by johny_ on 5 May 2004 @ 11am

btw
Server version: Apache/1.3.27 (Unix)
PHP version: 4.2.3

Posted by johny_ on 5 May 2004 @ 11am

Leave a Comment

Damn You Matt Metzger I Think I Found My Conference


ss_blog_claim=15f221fa5534b36dfd4dc0c2bcca99c1