I was away for a few days. Back now. Here is the PHP script I used:
<?php
$uploaddir = './'; //Uploading to same directory as PHP file
$file = basename($_FILES['userfile']['name']);
$uploadFile = $file;
$randomNumber = rand(0, 99999);
$newName = $uploadDir . "Demoted" . $randomNumber . $uploadFile;
if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
echo "Temp file uploaded. \r\n";
} else {
echo "Temp file not uploaded. \r\n";
}
if ($_FILES['userfile']['size']> 500000) {
exit("Your file is too large. It must be lest than 500k");
}
// This is an if statement that logs in the xCode debugger console the
server variables and
// the directory and format of file and size of file and type of file
// ECHO sends back to the iphone the important information which can
be trapped there for its own use
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $newName)) {
$postsize = ini_get('post_max_size'); //Not necessary, I was
using these
$canupload = ini_get('file_uploads'); //server variables to
see what was
$tempdir = ini_get('upload_tmp_dir'); //going wrong.
$maxsize = ini_get('upload_max_filesize');
//echo "http://lazyriver.on-rev.com/upload/{$file}" . "\r\n" .
$_FILES['userfile']['size'] . "\r\n" . $_FILES['userfile']['type'] ;
echo "http://lazyriver.on-rev.com/upload/{$newName}" . "\r\n" .
"Format is " . $file . "\r\n" . "Size is " . $_FILES['userfile']
['size'] . "\r\n" . "Type is " . $_FILES['userfile']['type'] ;
}
?>
This works perfectly to upload images from my app in the iPhone to the
folder that the PHP is in. I don't understand it but it works. I would
not even know where to begin to understand this or where to look with
out opening the door to the thousands of pages with things I don't
want to learn about PHP.
Now if this were to be able to be converted to iRev files and it works
then I would really want to learn it. (The point of iRev I think).
Tom McGrath III
Lazy River Software
[email protected]
iTunes Library Suite - libITS
Information and download can be found on this page:
http://www.lazyriversoftware.com/RevOne.html
On Nov 4, 2009, at 5:20 PM, Alex Tweedly wrote:
Thomas McGrath III wrote:
Overview:
I have been plugging away at writing an iPhone application that
manipulates photos and uploads them online (why I have been so
silent on the list for awhile). And except for a major confusion
working with the internal database (still unresolved) I have been
able to get everything else working.
What I can do so far is load a view on the iPhone and take a
picture or use a picture from the camera/library on the iPhone, add
a background, a frame and some text from a database. I can also
edit the text in a table and save to a user file in the device.
Lastly, I can email and SMS the final image to another phone or
computer and NOW I can send the picture up to rev-online via a
'borrowed' PHP script.
When you say "rev-online" I take it you mean on-rev ?
Sarah has an example on her wonderful on-rev samples page ( http://www.troz.net/onrev/
) of a script to upload pictures.
I'm not clear on how the iPhone sends the pictures via a borrowed
PHP script - but it might be easy to convert this irev script to
match it. (If you like, email me the PHP script and I'll have a look
at an iRev equivalent to it).
What I would like to do is have either iRev or a revWeb standalone
'know' when new images are uploaded and display them in the browser
for users to see and show. I would also like to have iRev/revWeb
send out a push notification to another iPhone application (the
image viewer) so that viewers will know that other users have
uploaded new pictures. I am studying up on the push notification on
the iPhone side.
If you can convert the upload mechanism to iRev then you're (almost)
done.
If not, you could run a rev script periodically (say one per minute
or once per 10 minutes) to check for the latest pictures, and then
update or push data accordingly. You could do this, as Shao Sean
suggested via a cgi or compiled rev app tun with -ui --- but that
would be new territory for me. You could write an iRev script that
checks for new photos (uploaded since the last time the script ran)
and pushes them out (that's pretty easy). And then you could trigger
that script periodically, using a cron job with curl.
(cron is simply a Unix mechanism to run the same command line app or
command at regular intervals, such as every so many minutes or hours
(or days, months, ...))
To do this, go into cPanel, click on "cron jobs" in the "Advanced"
section. Then click on "standard" for experience level, and fill in
the (pretty obvious) values, with the "command to run:" line being
curl http://www.mysitename.com/myscript.irev
-- Alex.
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution