Hi all,
I was just wondering if anyone's ever come across some code which will allow people to send an image from a camera mobile phone, to an email address, and for an ASP page (or PHP if needed) to display it?
I came across the below code, but after having a quick go at work, it kept throwing up errors (will have to look at home to see what they are - friendly errors are on at work X( );
I was just wondering if anyone has any tried and tested code?
Cheers all,
Oli
I was just wondering if anyone's ever come across some code which will allow people to send an image from a camera mobile phone, to an email address, and for an ASP page (or PHP if needed) to display it?
I came across the below code, but after having a quick go at work, it kept throwing up errors (will have to look at home to see what they are - friendly errors are on at work X( );
Code:
<script language=jscript runat=server>
function y2k(number) { return (number < 1000) ? number + 1900 :
number; }
function milliDif() {
var d = new Date();
return Date.UTC(y2k(d.getYear()),d.getMonth(),d.getDate(),d.getHours(),
d.getMinutes(),d.getSeconds(), d.getMilliseconds())
}
</script>
<%
'*************************************
'Brought to you by Johnny M
'Feel free to change anything you want
'Email suggestions/comments to: [email="[email protected]"][email protected][/email]
'*************************************
'Just change these four variables to your information
youremail = "[color=red]***@***.***[/color]"
yourpassword = "[color=red]***[/color]"
yourmailurl = "[color=red]****.***.***[/color]"
yourdirectory = "[color=red]D:\hshome\***\***\***\[/color]"
Set pop3 = Server.CreateObject( "JMail.POP3" )
pop3.Connect youremail, yourpassword, yourmailurl
Function getEmail(x)
if pop3.count > 0 then
Set msg = pop3.Messages.item(x)
Set Attachments = msg.Attachments
separator = ", "
For i = 0 To Attachments.Count - 1
If i = Attachments.Count - 1 Then
separator = ""
End If
Set at = Attachments(i)
If ( InStr(at.Name, "jpg") > 0 OR InStr(at.Name, "gif") > 0 ) Then
Randomize timer
randnum = int(rnd * 10000000)
timeNow = milliDif()
If right(at.Name, 3) = "jpg" then
filename = randnum & "-" & timenow & ".jpg"
Else
filename = randnum & "-" & timenow & ".gif"
End if
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
at.SaveToFile( yourdirectory & at.Name )
fso.MoveFile yourdirectory & at.Name, yourdirectory & filename
set fso = nothing
End if
Next
pop3.DeleteSingleMessage x
end if
End Function
x = pop3.count
DO UNTIL x = 0
getemail(x)
x = x - 1
Loop
pop3.Disconnect
%>
I was just wondering if anyone has any tried and tested code?
Cheers all,
Oli