Jump to content

messages displayed to browser for image uploading


paulgc34

Recommended Posts

using this code for image uploads:
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="pictures[]"/>
<input type="file" name="pictures[]"/>
<input type="file" name="pictures[]"/>
<input type="submit" value="Send Photos >>"/>
</form>
<?php
foreach ($_FILES["pictures"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["pictures"]["tmp_name"][$key];
$name = $_FILES["pictures"]["name"][$key];
move_uploaded_file($tmp_name, "data/$name");
}
}
?>

How do I print a "successful" message to the browser when it's done uploading and is there a way to dispay a "UPLOADING" MESSAGE WHILE IT'S IN PROGRESS?
Link to comment
Share on other sites

<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="pictures[]"/>
<input type="file" name="pictures[]"/>
<input type="file" name="pictures[]"/>
<input type="submit" value="Send Photos >>"/>
</form>
<?php
foreach ($_FILES["pictures"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
  $tmp_name = $_FILES["pictures"]["tmp_name"][$key];
  $name = $_FILES["pictures"]["name"][$key];
  move_uploaded_file($tmp_name, "data/$name");
  if (!is_file("data/$name") {
  $error='Image not uploaded';
  }
}
}
if (!$error) {
echo("Successfully uploaded all images");
} else {
echo("ERROR Images have not all been uploaded");
}
?>

No way to show uploading or a less you used javascript to popup a window that says uploading and then when window loaded u close the window by it's name..

Regards
Liam
Link to comment
Share on other sites

After you have done all the move_uploaded_file() you could Header() to another page and show a 'Your upload was successful'

As for showing a message saying 'Upload in Progress' I would look at using a javascript popup window or something.

I havent really played with javascript much so I cant show any code, but the idea should get ya in the right direction.

:)
Link to comment
Share on other sites

heres the code:

[color=red]<?php[/color]
foreach ($_FILES["pictures"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["pictures"]["tmp_name"][$key];
$name = $_FILES["pictures"]["name"][$key];
move_uploaded_file($tmp_name, "data/$name");
}
}
header("Location: http://www.escortlobby.com/");
[color=red]?>[/color]
Link to comment
Share on other sites

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>

</head>

<body>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.