Hi,
I have been on most of other sites forums but i didn't get solution of my problem, Hopefully here i will get some help as from recommendations of a friend of mine, he told me "best sites for php issues" is this one.
Here is my issue:
I have seen one script in here and I really really like it, i have tested it and is working fine, But my question is, If i want to make it to be a multi upload script what can i do or change to have that function?
I would like it to be with like 5 or 7 options for users to upload 5 or 7 files at one time i.e. one click.
Please help me so that i can use this script. All source codes can be found on here .
If anybody have a solution i will be very much appreciated.
Many Thanks.
Victor.
Help On PHP Upload Modification
Moderator: General Moderators
Re: Help PHP Upload Modification
This folder is not somewhere you can just ask for a script and someone will write it for you. We'll help you write it by solving your code issues, but that's where the assistance ends.Victor46 wrote:I have been on most of other sites forums but i didn't get solution of my problem, Hopefully here i will get some help as from recommendations of a friend of mine, he told me "best sites for php issues" is this one.
If you want someone to write the entire thing for you I'll move this thread to the Volunteer Work folder for you.
Alternatively, if you can pay someone to write the script for you, I'll move it to the Job Hunt folder.
Re: Help On PHP Upload Modification
onion2k,
Thank you for your reply, As i have said on my previous post, the script is already there and is working just fine for a single upload. So the thing i'm looking is to implement the multiple uploads on the same script.
I have tried to increase options manual (files inputs), but it is only uploading a single file even though you have selected 4 or 5 files. I know it needs to be changed somewhere on php or java script codes as this script uses both languages. And the issue here is, i'm not good on both languages, only good on html.
these codes are on my temporary test page in here, All other source codes are here:
If is possible for anybody to help me, Again I will be much appreciated for that.
Hope to get help from you guys.
Many thanks.
Thank you for your reply, As i have said on my previous post, the script is already there and is working just fine for a single upload. So the thing i'm looking is to implement the multiple uploads on the same script.
I have tried to increase options manual (files inputs), but it is only uploading a single file even though you have selected 4 or 5 files. I know it needs to be changed somewhere on php or java script codes as this script uses both languages. And the issue here is, i'm not good on both languages, only good on html.
these codes are on my temporary test page in here, All other source codes are here:
Code: Select all
<?php
@set_time_limit(90); // try to change to maximum allowed execution time for this page
define('CFG_UPLOADFOLDER','_uploadedfiles_xxxxx/');
$bSecure = (isset($_SERVER['HTTPS']))? true : false;
include('inc.ErrorHandling.php');
include('inc.init.php');
include('class.DataException.php');
include('class.File.php');
function ProduceJavaScriptResponse($aResponse){
$response = <<<EOD
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="Cache-Control" content="no cache" >
<meta http-equiv="Pragma" content="no_cache" >
<meta name="language" content="en" >
</head>
<body>
<script type="text/javascript">{code}</script>
</body></html>
EOD;
// encode into JSON
$jsResponse = 'window.parent.'. $_REQUEST['callback'] .'('. json_encode($aResponse) .');';
$response = str_replace('{code}', $jsResponse, $response);
return $response;
}
// Upload file
$errorMessage = '';
$aResponse = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
############################################################
if (!headers_sent()){
Header("Pragma: no-cache");
Header("Cache-Control: no-cache");
Header('Expires: '. GMDate("D,d M Y H:i:s") .' GMT');
}
$blacklist = array('.php', '.phtml', '.php3', '.php4');
foreach ($blacklist as $item) {
if (preg_match("/$item\$/i", $_FILES['_file']['name'])){
$errorMessage = 'Uploading PHP files is not allowed!';
}
}
try{
if ($errorMessage == ''){
$maxAllowedSize = null; // no limit (see FAQ)
$aAllowedContenTypes = null; // any file (see FAQ)
$oFile = File::UploadFile('_file', CFG_UPLOADFOLDER, $maxAllowedSize, $aAllowedContenTypes);
}
}catch(Exception $e){
$errorMessage = 'An error occured:'. $e->getMessage();
}
// produce response
if (isset($_REQUEST['output']) && $_REQUEST['output'] == 'js'){
if (!isset($_REQUEST['callback']) || empty($_REQUEST['callback'])){
// ERROR: BAD AJAX call
$errorMessage = "Bad Ajax call! URL argument \'callback\' was not specified.";
die('<script type="text/javascript">alert("'. $errorMessage .'");</script>');
}else if(empty($errorMessage) && $oFile){
// SUCCESS (file was uploaded)
$aResponse['result'] = 'success';
$aResponse['file'] = array('size' => $oFile->getSize(),
'sizeFormatted' => $oFile->FormatFileSize($oFile->getSize()),
'name' => $oFile->getName()
);
}else{
// UPLOAD ERROR
$aResponse['result'] = 'failure';
$aResponse['message'] = 'Upload error ('. $errorMessage .').';
}
$response = ProduceJavaScriptResponse($aResponse);
}else{
$response = file_get_contents('fileUploaded.tpl.php');
$aValues = array($oFile->getName(), $oFile->FormatFileSize($oFile->getSize()));
$aPlaceHolders = array('{filename}', '{filesize}');
$response = str_replace($aPlaceHolders,$aValues,$response,$count);
}
die($response);
############################################################
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="language" content="en" >
<meta name="description" content="Secure file uploading : a page for uploading files securely">
<meta name="author" content="attila szabo (http://www.w3net.eu)" >
<meta name="robots" content="noindex,nofollow" >
<title><?php if($bSecure){echo 'Secure ';}?>File Upload form</title>
<link media="handheld" href="css/handheld.css" type="text/css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="all" href="css/main.css">
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/FileListing.js"></script>
<script type="text/javascript" src="js/PageController.js"></script>
</head>
<body id="home">
<div id="container">
<ul id="skip">
<li><a href="#main">Skip to main content</a></li>
<li><a href="#form">Skip to the upload form</a></li>
</ul>
<iframe id="uploadIfr" src="blank.htm" name="uploadIfr" class="hiddenUploadIframe" title="ignore this frame"></iframe>
<!-- @@@ listing of uploaded files -->
<div id="uploadedFiles">
</div>
<!-- end listing of uploaded files @@@ -->
<a name="main"></a>
<h1><?php if($bSecure){echo 'Secure file';}else{echo 'File';}?> uploading</h1>
<?php
if($bSecure){
?>
<p class="message" id="annotationSecure">
Uploading files using this web page is secure. This webpage transmits the file using a high-level encryption so that
only I will be able to access the information.
Web pages beginning with "https" instead of "http" enable secure information transmission.
</p><?php
}else{
echo "<p></p>";
}
?>
<div id="frmAttachFile_ErrorMessage" class="form_boxErrorMsg" style="display: none"></div>
<!-- @@@ file upload form -->
<div id="fileuploadForm"><a name="form"></a>
<form name='frmUploadFile' id="frmUploadFile" action="index.php" method="post" enctype="multipart/form-data" > <!-- uploadIfr -->
<fieldset title="Choose the file to upload">
<legend> 1: Choose a file to upload</legend>
<p>Click the button to browse the file system of your computer. Find and select the file you want to upload.</p>
<label for="fileInput" class="form_label">File:</label>
<input type="file" accept="" name="_file" id="fileInput" ><br>
<label for="fileInput" class="form_label">File:</label>
<input type="file" accept="" name="_file" id="fileInput" ><br>
<label for="fileInput" class="form_label">File:</label>
<input type="file" accept="" name="_file" id="fileInput" ><br>
<label for="fileInput" class="form_label">File:</label>
<input type="file" accept="" name="_file" id="fileInput" ><br>
<label for="fileInput" class="form_label">File:</label>
<input type="file" accept="" name="_file" id="fileInput" ><br>
</fieldset>
<fieldset id="confirmation" title="Confirmation">
<legend> 2: Upload file</legend>
<p>When you have selected the file to upload, click on the <strong>Upload</strong> button.</p>
<div class="actionBar" id="submitBtnBox">
<input type="submit" value="Upload" >
</div>
</fieldset>
</form>
</div>
<!-- end file upload form @@@ -->
</div>
</body></html>Hope to get help from you guys.
Many thanks.
Last edited by Victor46 on Thu Oct 16, 2008 7:39 am, edited 2 times in total.
Re: Help On PHP Upload Modification
Show us the code you've made plz.
Re: Help On PHP Upload Modification
Papa, onion2k.
Thank you for your replies. Much appreciated for this.
I have just edited the above post showing codes of this script.
Thanks.
Victor.
Thank you for your replies. Much appreciated for this.
I have just edited the above post showing codes of this script.
Thanks.
Victor.
Re: Help On PHP Upload Modification
I just want to say thank you for those were trying to solve this problem.
I had a reply today from the author of this script and He agreed my views and he decided to change the script to have both single and multiple uploads capabilities.
Thanks to you and also Thanks to Attila Szabó of http://w3net.eu/ who made this happen and design such a fantastic script.
Victor.
This thread is now closed.
I had a reply today from the author of this script and He agreed my views and he decided to change the script to have both single and multiple uploads capabilities.
Thanks to you and also Thanks to Attila Szabó of http://w3net.eu/ who made this happen and design such a fantastic script.
Victor.
This thread is now closed.