Mobile Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreMobile Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 25th, 2006, 05:45 PM
Pantcho Pantcho is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 8 Pantcho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 46 sec
Reputation Power: 0
Red face WAP and Content-Disposition

Hello all, this is my first post.

Well i've been struggling with this:

is there a way that in my server in the cgi-bin
where i put my PHP script or whatever cgi
that loads an image file (image/jpeg) and send it trought the cgi/php script
to name the output file?
cuz when the user downloaded the image the default name of the saved image is the php/cgi name.

is there a way to change it?
i tried
"content-type: image/jpeg" + EOL + "Content-Disposition xxx"

xxx = what ever common syntax i tried, with no luck.

if there is a solution i would gladly happy.

thank you.

Reply With Quote
  #2  
Old January 26th, 2006, 04:36 AM
andymoo's Avatar
andymoo andymoo is offline
Timelord
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2003
Location: Loughborough, Leicestershire
Posts: 605 andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 5 h 53 m 46 sec
Reputation Power: 63
hi there, welcome onboard the devshed wap forums, nice to have someone else here.

some phones will reject images that are linked to as file.php as the extension of the url being called does not match the mime type you need to output so it would be better to do some url rewriting and have the user click a link like my-download.jpg which would then execute your PHP in the background.

then inside my-download.php you'd need to propagate this with some values:

PHP Code:
 header("Content-disposition: attachment; filename=$transactionid.$ext");
header("Content-type: $type\r\n");
header("Content-Transfer-Encoding: binary\r\n\r\n");
header("Content-type: $type"); 

hope this helps.
__________________
Andy Moore << oh no it's got a blog.....
Word Press WAP Plugin with Ad Mob Advertising revenue
PHP developer
deploying ringtones, mp3 downloads and realtones
I'm a geek who's obsessed with stats and gadgets

Reply With Quote
  #3  
Old January 26th, 2006, 06:11 AM
Pantcho Pantcho is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 8 Pantcho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 46 sec
Reputation Power: 0
well i tried your header and it doesnt work.
also, you use content-type twice?
and in the first line there is no \r\n
and in the thirs there is \r\n\r\n
and then the second time content-type

you script might be working if it will be in the correct formatting (which i try here and there with no luck)

if there is a way to pull this off it will be great!

so far no luck

Reply With Quote
  #4  
Old January 27th, 2006, 04:25 AM
andymoo's Avatar
andymoo andymoo is offline
Timelord
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2003
Location: Loughborough, Leicestershire
Posts: 605 andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 5 h 53 m 46 sec
Reputation Power: 63
www.php.net/header
www.php.net/file
www.php.net/file_get_contents

There's loads of inbuilt functions which will help you work this out, the \n\n\r and so on all contribute to a part of that script I didn't post which renders the files to the handset wrapped in open mobile alliance digital rights management 1 - or forward lock.... But that's for another time....

The PHP site has all you need on there really.

Hope this helps.

Reply With Quote
  #5  
Old December 18th, 2006, 06:15 PM
aleco aleco is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 2 aleco User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 39 m 24 sec
Reputation Power: 0
Hi andymoo,

Soz to drag up an old topic, but you mention wrapping the image in drm forward-lock...I think the "another time" is now!

I've been trying to dish out some images with forward-lock enabled, but with absolutely no luck so far Any chance you could share the php code with me if that's possible before it drives me insane!?

The code i've tried so far (found in a forum post elsewhere) is as follows:

PHP Code:
 header("Content-type: application/vnd.oma.drm.message; boundary=boundary-1");
print(
"--boundary-1\n");
print(
"Content-type: image/jpeg\n");
print(
"Content-Transfer-Encoding: binary\n");
print(
"\n");
fpassthru(fopen("test.jpg""rb"));
print(
"\n--boundary-1--\n"); 


Alas that doesn't do the trick

Thanks for any time you can spare!

Reply With Quote
  #6  
Old December 19th, 2006, 05:54 AM
andymoo's Avatar
andymoo andymoo is offline
Timelord
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2003
Location: Loughborough, Leicestershire
Posts: 605 andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 5 h 53 m 46 sec
Reputation Power: 63
sorry not a cat in hells chance. it took me ages to get the right code to drm something and there's no way i can give that away on a forum.

it's worth too much and took me too long to do.

even if you do figure out drm you still need to know when NOT to use it.........

Reply With Quote
  #7  
Old December 19th, 2006, 06:39 AM
aleco aleco is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 2 aleco User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 39 m 24 sec
Reputation Power: 0
Er, thanks. I've sorted it now anyway. Basically had it, just a minor issue with some linebreaks

Last edited by aleco : December 19th, 2006 at 06:46 AM. Reason: typo

Reply With Quote
  #8  
Old December 19th, 2006, 08:07 AM
andymoo's Avatar
andymoo andymoo is offline
Timelord
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2003
Location: Loughborough, Leicestershire
Posts: 605 andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 5 h 53 m 46 sec
Reputation Power: 63
that's the fun part of it. working out if it should be /r/n or /n/n or /r/n/r and that's the bit that seems to vary on different phones....

i finally sussed it some time back at 03.00 am and woke the girlfriend to say i'd cracked oma 1 - she just looked blankly at me and returned to sleep. can't understand why she never shared my enthusiasm.

drm would be okay but not all phones support it so it's as good as it gets but pointless if the device isn't going to do anything with the drm wrapped file.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreMobile Programming > WAP and Content-Disposition


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT