| | |
Coldfusion image upload w. javascript thumbnail preview
Please support our ColdFusion advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2006
Posts: 25
Reputation:
Solved Threads: 1
I've found a script that does almost exactly what I need but it uses PHP - I know nothing about PHP. Anyone here want to help me convert the PHP to Coldfusion? It's not a whole lot of code. Here's a demo and the source code is below the demo:
http://www.air4web.com/files/upload/
http://www.air4web.com/files/upload/
•
•
Join Date: May 2006
Posts: 25
Reputation:
Solved Threads: 1
Perhaps someone could just help me convert the PHP line below from PHP to Coldfusion and that would be a good start.
<?php
$ftmp = $_FILES['image']['tmp_name'];
$oname = $_FILES['image']['name'];
$fname = 'upload/'.$_FILES['image']['name'];
if(move_uploaded_file($ftmp, $fname)){
?>
<html><head><script>
var par = window.parent.document;
var images = par.getElementById('images');
var imgdiv = images.getElementsByTagName('div')[<?=(int)$_POST['imgnum']?>];
var image = imgdiv.getElementsByTagName('img')[0];
imgdiv.removeChild(image);
var image_new = par.createElement('img');
image_new.src = 'resize.php?pic=<?=$oname?>';
image_new.className = 'loaded';
imgdiv.appendChild(image_new);
</script></head>
</html>
<?php
exit();
}
?><html><head>
<?php
$ftmp = $_FILES['image']['tmp_name'];
$oname = $_FILES['image']['name'];
$fname = 'upload/'.$_FILES['image']['name'];
if(move_uploaded_file($ftmp, $fname)){
?>
<html><head><script>
var par = window.parent.document;
var images = par.getElementById('images');
var imgdiv = images.getElementsByTagName('div')[<?=(int)$_POST['imgnum']?>];
var image = imgdiv.getElementsByTagName('img')[0];
imgdiv.removeChild(image);
var image_new = par.createElement('img');
image_new.src = 'resize.php?pic=<?=$oname?>';
image_new.className = 'loaded';
imgdiv.appendChild(image_new);
</script></head>
</html>
<?php
exit();
}
?><html><head>
![]() |
Similar Threads
- How to validate an image field with javascript (JavaScript / DHTML / AJAX)
- Loading image to HTML (JavaScript / DHTML / AJAX)
- Image Upload/Acquisition (IT Professionals' Lounge)
- Need help with Image Swaping in Javascript (JavaScript / DHTML / AJAX)
- calculate image property in javascript (JavaScript / DHTML / AJAX)
- Icon and Thumbnail Display Problem (Windows NT / 2000 / XP)
Other Threads in the ColdFusion Forum
- Previous Thread: Coldfusion Email Server Software
- Next Thread: Coldfusion Scheduled Tasl
| Thread Tools | Search this Thread |





