By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,666 Members | 1,784 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,666 IT Pros & Developers. It's quick & easy.

image upload with pagination

P: n/a
mac
Hi,

I'm looking for a script that will allow me to upload images to a
folder and shows pagination...
pls can any body help me?

i hav done with the uploading, but not able to do with the
pagination...here is the upload code..

<?php
define ("MAX_SIZE","100");
function getExtension($str) {
$i = strrpos($str,".");
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext; }

$errors=0;
if(isset($_POST['Submit'])) {
$image=$_FILES['image']['name'];
if ($image) {

$filename = stripslashes($_FILES['image']['name']);
$extension = getExtension($filename);
$extension = strtolower($extension);
if (($extension != "jpg") && ($extension != "jpeg") && ($extension !=
"png") && ($extension != "gif")) {
echo '<h1>Unknown extension!</h1>';
$errors=1; }
else {
$size=filesize($_FILES['image']['tmp_name']);
if ($size MAX_SIZE*1024){ echo '<h1>You have exceeded the size
limit!</h1>'; $errors=1;}
$image_name=time().'.'.$extension;
$newname="images/".$image_name;
$copied = copy($_FILES['image']['tmp_name'], $newname);if (!$copied)
{ echo '<h1>Copy unsuccessfull!</h1>';
$errors=1;}}}}

if(isset($_POST['Submit']) && !$errors) { echo "<h1>Image Uploaded
Successfully! Try again!</h1>"; } ?>

<form name="newad" method="post" enctype="multipart/form-data"
action=""<table <tr><td><input type="file" name="image"></td></tr>
<tr><td><input name="Submit" type="submit" value="Upload image"></
td></tr</table> </form>
Sep 11 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Thu, 11 Sep 2008 00:38:49 -0700, mac wrote:
I'm looking for a script that will allow me to upload images to a folder
and shows pagination...
pls can any body help me?

i hav done with the uploading, but not able to do with the
pagination...here is the upload code..
You should use move_uploaded_file() instead of copy().

What do you mean by pagination? What have you tried so far?
Sep 11 '08 #2

P: n/a
On 11 Sep, 08:38, mac <mhmun...@gmail.comwrote:
Hi,

I'm looking for a script that will allow me to upload images to a
folder and shows pagination...
pls can any body help me?
Where have you looked?

did you try putting
image upload with pagination
into Google and clicking "I'm Feeling Lucky"?
Sep 11 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.