It looks like you're new here. If you want to get involved, click one of these buttons!
<?php
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
$ext = pathinfo($_FILES['Filedata']['name'], PATHINFO_EXTENSION); //figures out the extension
$newFileName = md5($tempFile).'.'.$ext; //generates random filename, then adds the file extension
$targetFile = str_replace('//','/',$targetPath) . $newFileName;
move_uploaded_file($tempFile,$targetFile);
}
if ($newFileName)
echo $newFileName;
else // Required to trigger onComplete function on Mac OSX
echo '1';
?>
$(\"#picupload\").fileUpload({
'uploader': 'scripts/upload/uploader.swf',
'cancelImg': 'scripts/upload/cancel.png',
'script': 'scripts/upload/upload_name.php',
'folder': 'files',
onComplete: function (evt, queueID, fileObj, response, data) {
$(\"#uploadedpics\").append(\"<input type='hidden' name='pic' value='\" + response + \"' />\"); //adds hidden form field to uploadedpics div
$(\"#picupload_div\").empty(this).append(\"<h3>Image Successfully Uploaded</h3>\"); //clears browse button, replaces with success message
},
});
<form>
<div id=\"picupload_div\">
<p><label for=\"file\">Image:</label> <input type=\"file\" name=\"picupload\" id=\"picupload\" /></p>
</div>
<div id=\"uploadedpics\">
<!-- hidden form field posts to here -->
</div>
</form>
<?php
include \"config.php\";
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
$ext = pathinfo($_FILES['Filedata']['name'], PATHINFO_EXTENSION); //figures out the extension
$newFileName = md5($tempFile).'.'.$ext; //generates random filename, then adds the file extension
$targetFile = str_replace('//','/',$targetPath) . $newFileName;
move_uploaded_file($tempFile,$targetFile);
echo $newFileName;
else // Required to trigger onComplete function on Mac OSX
echo '1';
}
?>
<script type=\"text/javascript\" src=\"javascript/jquery.js\"></script>
<script type=\"text/javascript\" src=\"javascript/jquery.uploadify.js\"></script>
<script type=\"text/javascript\">
$(document).ready(function() {
$(\"#fileUpload\").fileUpload({
'uploader': 'uploader.swf',
'cancelImg': 'images/cancel.png',
'folder': 'uploads',
'script': 'upload.php',
'buttonText': 'Select File',
'displayData': 'percentage',
'onComplete': function(event, queueID, fileObj, reposnse, data) {
$('#filesUploaded').append('<a href='+fileObj.filePath+'>'+fileObj.name+'</a><br>');
}
});
});
</script>
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
$ext = pathinfo($_FILES['Filedata']['name'], PATHINFO_EXTENSION); //figures out the extension
$newFileName = md5($tempFile).'.'.$ext; //generates random filename, then adds the file extension
$targetFile = str_replace('//','/',$targetPath) . $newFileName;
move_uploaded_file($tempFile,$targetFile);
}
if ($newFileName)
echo $newFileName;
else // Required to trigger onComplete function on Mac OSX
echo '1';
$(document).ready(function() {
$(\"#uploadify\").uploadify({
'uploader' : 'videos/uploader/scripts/uploadify.swf',
'script' : 'videos/uploader/scripts/upload_name.php',
'cancelImg' : 'videos/uploader/cancel.png',
'folder' : 'videos/uploads',
'queueID' : 'fileQueue',
'auto' : true,
'multi' : false,
onComplete: function (evt, queueID, fileObj, response, data) {
$(\"#videpath\").append(\"<input type='hidden' name='FLV_url' id='flv' value='\" + response + \"' />\"); //adds hidden form field to uploadedpics div
$(\"#fileQueue\").empty(this).append(\"<span class='uploaded'>Upload successfully! Go to step #2</span>\"); //clears browse button, replaces with success message
},
});
});
<div id=\"fileQueue\"><input type=\"file\" name=\"uploadify\" id=\"uploadify\" /></div>
<div id=\"videopath\"> </div>
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
<!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=utf-8\" />
<title>Uploadify Example Script</title>
<link href=\"css/default.css\" rel=\"stylesheet\" type=\"text/css\" />
<link href=\"css/uploadify.css\" rel=\"stylesheet\" type=\"text/css\" />
<script type=\"text/javascript\" src=\"scripts/jquery-1.3.2.min.js\"></script>
<script type=\"text/javascript\" src=\"scripts/swfobject.js\"></script>
<script type=\"text/javascript\" src=\"scripts/jquery.uploadify.v2.1.0.min.js\"></script>
<script type=\"text/javascript\">
$(document).ready(function () {
$(\"#uploadify\").uploadify({
'uploader': 'scripts/uploadify.swf',
'script': 'scripts/uploadname.php',
'cancelImg': 'cancel.png',
'folder': 'uploads',
'queueID': 'fileQueue',
'auto': true,
'multi': true,
'buttonText': 'Get Image',
'onComplete': function (evt, queueID, fileObj, response, data) {
var imgURL = 'http://localhost/catthumbs/' + response ;
$(\"#uploadedpics\").append(\"<input type='hidden' name='pic' value='\" + response + \"' />\"); //adds hidden form field to uploadedpics div
$(\"#picupload\").empty(this).append(\"<h3>Image Successfully Uploaded</h3>\"); //clears browse button, replaces with success message
$(\"#thumb\").append(\"<img src='\" + imgURL + \"' >\");
}
});
});
</script>
</head>
<body>
<div id=\"fileQueue\"></div>
<input type=\"file\" name=\"uploadify\" id=\"uploadify\" />
<div id=\"uploadedpics\"></div>
<div id=\"picupload\"></div>
<div id=\"thumb\"></div>
</body>
</html>
<?php
$myPath = \"C:\\Pageflex\\Studio7.5\\Projects\\BizCard\\Images\\\";
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
//$targetPath = $myPath;
$ext = pathinfo($_FILES['Filedata']['name'], PATHINFO_EXTENSION); //figures out the extension
$newFileName = md5($tempFile).'.'.$ext; //generates random filename, then adds the file extension
//$targetFile = str_replace('//','/',$targetPath) . $newFileName;
$targetFile = $myPath . $newFileName;
move_uploaded_file($tempFile,$targetFile);
}
//NEW BIT
$imgsize = getimagesize($targetFile);
switch(strtolower(substr($targetFile, -3))){
case \"jpg\":
$image = imagecreatefromjpeg($targetFile);
break;
case \"png\":
$image = imagecreatefrompng($targetFile);
break;
case \"gif\":
$image = imagecreatefromgif($targetFile);
break;
default:
exit;
break;
}
$width = 80; //New width of image
$height = $imgsize[1]/$imgsize[0]*$width; //This maintains proportions
$src_w = $imgsize[0];
$src_h = $imgsize[1];
$picture = imagecreatetruecolor($width, $height);
imagealphablending($picture, false);
imagesavealpha($picture, true);
$bool = imagecopyresampled($picture, $image, 0, 0, 0, 0, $width, $height, $src_w, $src_h);
if($bool){
switch(strtolower(substr($targetFile, -3))){
case \"jpg\":
header(\"Content-Type: image/jpeg\");
//$bool2 = imagejpeg($picture,$myPath.\"Thumbs/\".$_FILES['Filedata']['name'],80);
$bool2 = imagejpeg($picture,$myPath.\"Thumbs/\".$newFileName);
break;
case \"png\":
header(\"Content-Type: image/png\");
imagepng($picture,$myPath.\"Thumbs/\".$_FILES['Filedata']['name']);
break;
case \"gif\":
header(\"Content-Type: image/gif\");
imagegif($picture,$myPath.\"Thumbs/\".$_FILES['Filedata']['name']);
break;
}
}
imagedestroy($picture);
imagedestroy($image);
//echo '1'; // Important so upload will work on OSX
//END NEW BIT
if ($newFileName)
echo $newFileName;
else // Required to trigger onComplete function on Mac OSX
echo '1';
?>