/*Following code is to upload and save a jpeg image in PHP -
works ONLY with POST in the form!
add checks for GIF OR remove all checks to cater for other formatsBest to put this code before HTML code*/
global $userfile, $userfile_name, $userfile_size, $userfile_type, $archive_dir, $WINDIR;if(isset($WINDIR)) $userfile = str_replace("\\\\","\\", $userfile);
$filename = basename($userfile_name);
$lcfilename = strtolower($filename);
// check file extension
$ftype = strstr($lcfilename,'.j');
if ($ftype == ".jpg") $jpegok = "y";
if ($ftype == ".jpeg") $jpegok = "y";
if (!$jpegok) echo "<script language=\"javascript\"> alert('You must supply a JPEG file.')</script>";
else {
if($userfile_size <= 0) die ("$filename is empty.");
if(!@copy($userfile, "$archive_dir/$filename")) die("Can't copy $userfile_name to $filename.");
if(!isset($WINDIR) && !@unlink($userfile))
die ("Can't delete the file $userfile_name.");
// if entering data in a database following upload this is the place to do it!
}/* in the body of the HTML at the appropriate point you need
<input name="userfile" type="file" size="30">
*/
Hi Everyone,
I have finished my version with the image-upload function. (sorry but it's
in dutch)
For the upload i use Aspupload that you can download for a free 30-days trail.
For download see
http://www.aspupload.com
Only thing that i want to change is the insert_image dialog so you can select
the images from the uploadfolder and get a preview.
-------------------------------------------------------------
Modify these files and lines to get the upload script working
-------------------------------------------------------------
progress_upload.asp, line 44
replace the path to your upload path.
n = Upload.Save("e:\Inetpub\wwwroot\z_testzone\HTMLarea_wme\uploads\")
deletefiles.asp, line 40
replace the path to your upload path.
Directory = "e:\Inetpub\wwwroot\z_testzone\HTMLarea_wme\uploads\" ' initial
directory
Add two custom buttoms in editor.js
this.toolbar = [
['custom2','custom3','separator'],
this.btnList = {
"custom2": ['custom2', 'Upload file', 'editor_action(this.id)',
'ed_image_up.gif'],
"custom3": ['custom3', 'Verwijder files', 'editor_action(this.id)',
'ed_image_del.gif'],
Custom buttom section.
// Custom2 - upload files
else if (cmdID.toLowerCase() == 'custom2'){
window.open('popups/upload/progress.Asp',null,'width=390,height=225,status=no,scrollbars=auto,toolbar=no,menubar=no,location=no');
}
// Custom3 - Delete files
else if (cmdID.toLowerCase() == 'custom3'){
window.open("popups/upload/deletefiles.Asp",null,"height='100',width='380',status=no,toolbar=no,scrollbars=yes,menubar=no,location=no");
}
If you find bugs please let me know !!!
If there are people who are working on a Table-function thats better then
the function in version 2.03
(delete, insert, modify rows and collumns) or other functions please let
me know ;-)
This version contains also following extra functions:
I hope you like it
Wink
Greetz
Redspider
(Belgium)
Still 3 hours and 40 minutes untill 2003 (in Belgium), enjoy
Cool
Thanks so much
for your contribution! You should make a lot of ASP htmlArea users happy...!
CoolCool
And Happy New Year...? Almost? Another 20 minutes, maybe?
Wink
Ben
interactivetools.com
(This post was
edited
by Benjamin on Dec 31, 2002, 2:45 PM)
Redspider, do
you have a php-version also?
greetings, Leo -
aweTakeThisOuT at KILLspambe.tf (also belgium!)
Leo,
Sorry, but at this moment i just have a little knowledge of ASP, so i just
have an ASP version.
Maybe, you can find a sollution at
www.hotscripts.com or
www.planet-source.com where you can find a lot of scripts
and components.
If i find something i will post it in this forum.
greetz
Redspider
(belgium)
i have a PHP version
for uploading images
i am going to rewrite it for use with sql , so i can use extra info for the
images.
the old php version may be used by people that can use it, but don't think
is the ultimate tool.
if you want it, please mail me so i can prepare the files to add it for download
To mail you, I'll
need your email-adress.
But, never mind, I wrote the thing myself yesterday.
Anyway, thanks.
Hello!
Can u send me your PHP Script to Uplod!
Thanks Daniel
Quote
Here is some PHP upload code for you - hope it can be used - keep us posted!
/*Following code is to upload and save a jpeg image in PHP -
works ONLY with POST in the form!
add checks for GIF OR remove all checks to cater for other formatsBest to put this code before HTML code*/
global $userfile, $userfile_name, $userfile_size, $userfile_type, $archive_dir, $WINDIR;if(isset($WINDIR)) $userfile = str_replace("\\\\","\\", $userfile);
$filename = basename($userfile_name);
$lcfilename = strtolower($filename);
// check file extension
$ftype = strstr($lcfilename,'.j');
if ($ftype == ".jpg") $jpegok = "y";
if ($ftype == ".jpeg") $jpegok = "y";
if (!$jpegok) echo "<script language=\"javascript\"> alert('You must supply a JPEG file.')</script>";
else {
if($userfile_size <= 0) die ("$filename is empty.");
if(!@copy($userfile, "$archive_dir/$filename")) die("Can't copy $userfile_name to $filename.");
if(!isset($WINDIR) && !@unlink($userfile))
die ("Can't delete the file $userfile_name.");
// if entering data in a database following upload this is the place to do it!
}/* in the body of the HTML at the appropriate point you need
<input name="userfile" type="file" size="30">
*/
(This post was
edited
by aeon on Jan 7, 2003, 11:41 AM)
Questions:
.