...

Adding ajax upload module to existing php upload page

Daniellez
03-16-2009, 03:46 PM
1) Project Details: (be as specific as possible): I'd like to add the following to my existing upload page/script: http://www.dhtmlx.com/docs/products/dhtmlxVault/index.shtml

2) Payment Amount: $20

3) Payment method/ details (Paypal, check? Timeline?): PayPal

4) Additional Info (about project or potential bidders):

Here's the existing code for the upload page:

auth.php
<?php

if (!@include_once("./config.php"))
include_once("../config.php");

@session_save_path($session_save_dir);
session_start();

function authent_user () {
if (isset($_SESSION['session_username']) && isset($_SESSION['session_password'])) {
$fd = fopen($user_file, "r");
while (!feof($fd)) {
$userdata = explode("|", fgets($fd));
if ($_SESSION['session_username'] == $userdata[0] && $_SESSION['session_password'] == $userdata[1]) {
fclose ($fd);
return true;
}
}
fclose ($fd);
exit("<div class='error'>Access Denied!</div>");
}
}

?>


Upload form:

if (!@include_once("./inc/auth.php"))
include_once("../inc/auth.php");

if ($AllowUpload && isset($_GET['upload']))
{
if (!isset($_FILES['userfile']))
// maximum post size reached
print $StrUploadFailPost;
else
{
for($i=0;$i<=3;$i++)
{
if (move_uploaded_file($_FILES['userfile']['tmp_name'][$i], realpath($home_directory.$path)."/".str_replace(' ', '_', $_FILES['userfile']['name'][$i])))
print "$StrUploading";
else if ($_FILES['userfile']['name'][$i])
print "$StrUploadFail";
}
}


print "<form action='$base_url&amp;output=upload&amp;upload=true' method='post' enctype='multipart/form-data'>";

print "<table class='upload'>";
print "<tr><td>$StrFirstFile</td><td><input type='file' name='userfile[]' size=30></td></tr>";
print "<tr><td>$StrSecondFile</td><td><input type='file' name='userfile[]' size=30></td></tr>";
print "<tr><td>$StrThirdFile</td><td><input type='file' name='userfile[]' size=30></td></tr>";
print "<tr><td>$StrFourthFile</td><td><input type='file' name='userfile[]' size=30></td></tr>";
print "</table>";

print "<input class='go' type='image' src='gfx/button_upload.png' alt='$StrUpload' value='$StrUpload' style='margin-top: 16px;'>";
print "<input type='hidden' name=path value=\"".htmlentities($path)."\">";
print "</form>";

aimerzz4
03-21-2009, 01:59 AM
This is doable. Do you have a specific webpage on where you want the script located?

Daniellez
03-21-2009, 02:19 AM
I do. I can provide ftp access as well.

Sim
03-21-2009, 02:39 AM
I can do and I will also secure your script as if someone uploads some js files or php files. they can erease ALL FILES on your server. I learned the hard way last year about that =)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum