A PHP Function For Saving An Image To The Local Hard Drive?
I am looking for a PHP function that when run, would save an image to
the user's hard drive.
View Complete Forum Thread with Replies
Related Forum Messages:
Reference A File On My Local Hard Drive As A Include?
I know this is probably a very dumb question with a very easy answer (and yes, I did Google it - it's probably just so self explanitory that no one's ever had the occasion to ask before. Can I reference a file on my local hard drive as a PHP "include?" I realize that simply by virtue of the fact that PHP is a server-side languge, the answer is probably "no," but I like to be told "no" rather than just assume it. The guts of the file I'm working on live on my local machine, and I just need to get it through the PHP script on the server... Rather that go through the extra step of uploading the file to the server and then running it through the PHP script, I just thought it would be nice if I could cut out that middle step.
View Replies !
Reading Directory Of Hard Drive
This is probably starring me in the face but how do I read the contents of a hard drive directory? I've been playing around with the opendir($dir) sample from php.net and can read from the server without problem but how can I read a list of files from the hard drive of the PC (win98 (spit!)) I'm using? Basically what I want to do is read the file names of a certain directory on the hard drive into an array and then upload them all onto the server.
View Replies !
Reading File From Hard Drive
I am creating a resize script that takes a jpg image from the user's computer and resizes it to 768px for height, while retaining the original proportions. Below is my script, but how can I get the image from the user's computer, instead of reading it directly from the server? <?php $imgfile = 'smp.jpg' header('Content-type: image/jpeg'); list($width, $height) = getimagesize($imgfile); $newheight = 768; $newwidth = $newheight * ($width / $height); $thumb = ImageCreateTrueColor($newwidth,$newheight); $source = imagecreatefromjpeg($imgfile); imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); imagejpeg($thumb); ?>
View Replies !
Copying Server Directory To Hard Drive
I have been trying to backup a directory in one of my CPanel accounts to my hard drive. First I tried via FTP but for some reason, when accessing that directory, only a fraction of the total files in there appear (about 150 out of over 800 MB of files). I then tried to do a full home backup via CPanel but the same problem occurred (about 300 MB only). In CPanel's File Manager I can actually see all the files but given that they amount to thousands, it's not like I'm going to manually download them one by one (and I see no option to download a full directory) So I was thinking that maybe I could use a PHP script and get it to download all the files in that directory one by one to my hard drive. I checked out the copy() function but frankly I am dumbfounded on how I could get it to copy ever file in that one directory to my hard drive.
View Replies !
Readdir From Local Hard Disk
I have written a script to upload images from a clients hard disk to our server, which works fine. I would like to display all images on a direcvtory so that I can upload an image based upon the thumbnail display. I am having trouble trying to ger a dir listing the clients c: drive? $fd = opendir("$ImageDir"); while($entry = readdir($fd)) { $dis = substr($entry,0,2); if ($dis!= "10"){ if(eregi(".(jpg¦gif¦png)$",$entry)) { echo "<a href=$PHP_SELF?pic=/images/$entry>/images/$entry</a>"; echo "<a href="/images/$entry">"; echo "<img src="/images/$entry" align=middle border=0 height=80 width=100>"; echo " $entry</img></a><br>"; } Where $ImageDIr could be c:/apache/htdocs/images Can anybody please help?
View Replies !
Saving Email Attachments To Local Computer
I receive a daily email attachment, which is a zipped .csv file. I am trying to write a script that is able to read this csv file. Currently I am using the IMAP function and I am able to access my mailbox and get the name of the attachment, but this is where I've hit a stopping point. Is it possible to save the attachment to my local computer? From there I could use the zip_read function. I have tried file_put_contents, but that doesn't seem to work because of the .zip format.
View Replies !
Saving An Image
Is this possible? If I get the image via fopen and I echo the image to IE I get a screen full of strange characters.
View Replies !
Image Saving
i created an image resizing script, and am having trouble saving the resized image to the server. PHP Code: imagejpeg($image_resized, $imagelocation); should save the image to where i designate $imagelocation as, but it doesn't. Should i use fopen instead. Also, is there any way i can make it so this script scan folders and apply the script to certian files in them. PHP Code: <?php      //dan's lame image resizer // Load image $image = open_image('flower.jpg'); if ($image === false) { die ('Unable to open image'); }.
View Replies !
Image Not Saving Properly???
When I test the code that is below, it doesn't display the text on the image after it has been saved. Also when it saves the image, it only saves it as .jpeg and not the $pagetitle. Code:
View Replies !
Resizing Image And Saving
does anyone know how I could upload a photo and resize (by ratio) it before saving it to disk, the following script is the one I use to upload, rename, save to server and reference to my database. Code:
View Replies !
Saving Image From Browser
I have a quick script that I wrote to display some images in a gallery format. I wanted to track the views of each image, so instead of directing linking each thumbnail to the larger image, i linked it to a php file which updated a database field and then redirects to the image using headers. if($_GET['image']){ $id = $_GET['image']; mysql_query("UPDATE downloads SET downloads= downloads + 1 WHERE id = '$id'"); $sql = mysql_query("SELECT link FROM downloads WHERE id = '$id'"); $row = mysql_fetch_object($sql); header("Location: " . $row->link); } The problem is, after the image is now opened in the browser window, and you go to save it, it doesn't save as the proper image type. In firefox, it will always save as a PHP file, and IE, always a bitmap (when they are jpg's).
View Replies !
Dynamic Image Saving
I have a page thats sole function is to generate a dynamic image. When the image is loaded on screen, the only code within the source code body is <img alt="my alt tag" src="http://www.my-site.com/get.php?image_id=1" /> When i right click on the image and try a "save as.." the suggested file name is *get.php.jpg*. So good so far. What i want to do is load this page in the buffer or cache, then rename and save the generated image to a designated folder on my server, instead of displaying it. Once i save the image, i will just header() to another page for display. Is there a way to do what i describe?
View Replies !
Saving A Dynamically Created Png Image
I have a web site that responds to a user request by sending an image generated dynamically. the request page call is something like this <img id = "picid" src= "generateimage.php?$picName"> Where $picName holds the parameters needed for a particular image generateimage.php sends the request to the server which generates the image as $pngstr and responds: header("Content-Type: image/png".chr(13).chr(10)); header("Content-Length: ".strlen($pngstr).chr(13).chr(10).chr(13).chr(10)); echo $pngstr; Now, I want the user to be able to right click the image and save it with a given name - related to but not exactly $picName, as a png. I also have a set of images forming an animation generated in much the same way as the single image described above. How could I have the user save these? is there an animated png yet?
View Replies !
Make A Duplicate Row Of Saving The Image
I have image in database tables. I want to make a duplicate row of aving the image. how can i do it ? query like: insert into table_name (image_column) values (select image_column from table_name); Above query is not working.
View Replies !
Resize Image: Local Vs Http
I am having trouble resizing an image when I use the full "http://www.mysite.com/somepicture.jpg"... I just switched servers so I am thinking it might be a setting in PHP i need to change? if I just use "somepicture.jpg" on this new server it works without a problem. Otherwise it just hangs forever. Code:
View Replies !
Mail Attachment Saving Function
here's a little function I threw together that can save attachments from messages retrieved via the IMAP library. Note that the function takes two arguments, the first being the mailbox opened by imap_open(), and the second the message number of the message you want to retrieve the attachments/body from. note that the function dosn't check the validity of a message of $mnum actually existing, as in the code I wrote it for, the message number was checked for validity before calling the function. The function returns a string containing the body of the message, as well. Oh yea, it also dosn't save attachments of type 0 (7-bit) and 5 (Other). still playing with that functionality.
View Replies !
Saving Result Of Function Without Being Echoed
I am trying to save the function "rand(1, 1000000)" in a variable but when I am for example trying: $randomnumber = rand(1, 1000000); it is executing it right ahead while when i try $randomnumber = "rand(1, 1000000)"; or $randomnumber = 'rand(1, 1000000)' It is saving rand(1, 1000000) as variable. But what I need is a variable saving the result of rand(1, 1000000) so the number does not change either. Any ideas how I would do this?
View Replies !
Non-local SMTP Mail Function.
I am working on a webpage that is on a different server than the email server that the company wants me to use to send emails. Is it possible to change the PHP.ini file to use this non-local SMTP server, or is it not that simple?
View Replies !
Saving Form Variables Using A Java Function
I would like to know if it is possible to save a value from a php form in a session using a java function. What I am doing: I have a php form. The form contains a textbox and 2 list menus (drop down box) The second drop down box relies on the selection made in the first. within the reload() java function I save the value entered in the first list menu (using the onChange="reload(this.form)" ) I pass the variables in the url. The users selection loads values into the second list menu. Where the user can make a second selection. This value is passed using the same method. What I would like to do is save the textbox (or all the entered values) values in a session using a java function. When the user changes the a value or enters one.
View Replies !
Date Function On Local Server To Remote Host
This little combo was giving me Sunday, April 30 on my local server and Thursday, April 1 on my remote host, and I can't for the life of me figure out why. I could swear it used to work. PHP Code: $today = gmmktime(0,0,0,date('m,d,Y',gmmktime())); echo gmdate('l, F j', $today); (The first function gives me a "midnight" time stamp, so all dates put into the db, and compared to it, are consistent). When I rewrote it thus, it worked fine on both hosts: PHP Code: $m = date('m',gmmktime()); $d = date('d',gmmktime()); $y = date('Y',gmmktime()); $today = gmmktime(0,0,0,$m,$d,$y); Any idea what the heck is going on?
View Replies !
Php Function To Read Local Python Script Output, Not Code
On my server python has to run in the wwwroot/cgi-bin folder, but php can run anywhere. My site is going to be written in python but I don’t want my user to see the url as mysite/cgi-bin/... . So for example my homepage, index.php should contain a simple php script that will get my python page from the cgi-bin directory and display it. However when I try to use SSI or fopen/file_get_contents/readlink and commands like these it just displays the python code. Where as when I visit the python page in my browser it runs it and displays the output for me. My question is what php function can I use to execute my python page and return the output, not the code itself. (I think my hosting provider has disallowed certain powerful commands like system() etc. Does this make it impossible?). As the very least can’t my php script pretend to be a www user and ‘visit’ the python page to read the output?
View Replies !
Saving An Image From A "file" Form?
How do I recieve a picture from a form off a website and save it to a directory? I use the "file" form to allow the user to browse their local drive but how do I get the actual picture so I couild use it later?
View Replies !
Mail() [function.mail]: SMTP Server Response: 550 Not Local Host Gmail.com
I do a mail() and get: Warning: mail() [function.mail]: SMTP server response: 550 not local host gmail.com, not a gateway in C:xamppxampphtdocs estsitemail.php on line 7 <?php ini_set("SMTP","rlwatkins.com"); ini_set("sendmail_from","hunter@rlwatkins.com"); mail("huntercjcarroll@gmail.com","hello me","spamtastic","From: hunter@rlwatkins.com"); ?> what is wrong with this, how do i set it so that i can send to something other than localhost?
View Replies !
Search Script - Warning: Include(usr/local/lib/php/index.php) [function.include]: Failed To Open Stream:
A while ago I installed a script. It all worked just fine untill my host upgraded the servers. Since that moment I have an error message when I try to do a search. This is the error: Warning: include(usr/local/lib/php/index.php) [function.include]: failed to open stream: No such file or directory in /var/www/g28894/planthunteronline.com/HTML/directory/links.php on line 13 Warning: include() [function.include]: Failed opening 'usr/local/lib/php/index.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/g28894/planthunteronline.com/HTML/directory/links.php on line 13 Below I have added a part the script that may cause the problem (the complete script is to large to post). Please keep in mind that I am not a php programmer and I don't understand anything about it. I am just looking for a part of code that can solve the problem. Code:
View Replies !
Where Did My Hard Returns Go?
I created an edit_task page that allows the user to edit tasks for the database. I entered some text and used some hard returns. Put when I went to view the tasks (using a PHP script if it matters), the hard returns didn't "take." None of em. All of the text is jumbled together. Well I checked within the MySQL database just now (before uploading this message) and noticed the Hard Returns show in the database (at least while using phpMyAdmin). Must have something to do with PHP? Where did I go wrong?
View Replies !
Hard To Explain Bug
i have a script which lets you attack a monster to gain hp. link and you attack the monster and gain exp. all that good rpg stuff. now the problem is. when someone clicks the link, and holds enter. you kill multiple enemies get a ton of exp and it isnt what i want. could someone suggest a wuick fix for this?
View Replies !
Hard Return
I did not write it but got it from a freeware site. Anyway it works well, except I've discovered that if someone writes a message and uses the enter key, that will hangup the GuestMap. There is no error message, the icons simple will not load and no one else can enter a message. My solution is to have PHP code remove all hard returns form the strings before they are stored in the database. But I'm not sure what the code would be for that. I'm sure it's easy but I don't actually know much about PHP programming.
View Replies !
Hard Disk Space
i would like to know how to find a file in the entire system, i want to create a search so that the user enters the file name and the the script searches the entire system for the file,and later on displays the result of the search.
View Replies !
Hard Htaccess Problem...
i'm having a right problem with this. I'm basicly tying to make a hotlink protection file. I need to allow 2 domains: www.mysite.com www.google.***/ig *** = .com / .co.uk / .eu / .ch / .anything Google has lots of extensions, and they all need to be allowed to view my page when after the first / "ig" follows. So if say www.google.com tried to download a file. It would be blocked. BUT if www.google.com/ig tried to download, that would be ok. As would www.google.co.uk/ig
View Replies !
Hard To Explain In Subject
Ok Im trying to use the below code on my site to stop users from clicking my submit button 100 times real fast and posting 100 items at once, this code works on other sites but not mine, after a lot of playing around I found the problem to be because in my header I have to use Code:
View Replies !
IIS Extension_dir Not On Drive C
I used Apache and Omnihttpd web servers with php for a long time on my test server without any problem. Recently I installed IIS for W2K workstation. All three servers share the same doc root and php 4.3.2 installation. The problem I have with IIS is that php complain about not finding extensions modules in d:httpdphpextensions directory. I have not this problem with other servers. After some searches, I discovered that the only way to load extensions with IIS was to put them on drive C.
View Replies !
CD/DVD Drive Path
Is the CD/DVD drive "D:" or "Z:" or "/mnt/cdrom1" or what? It's easy enough to prompt the user to browse for that info. I'd like to find out if there is already some kind of built-in PHP directory walker that can discover this? I could run through is_dir('D:/mydir',...'Z:/mydir') and is_dir('/mnt/cdrom/mydir',...'/mnt/cdrom4/mydir') or something. It seems inefficient. mnoGoSearch might be a little faster, unless a fresh index needs to be made with each initialization, if I understand the docs for this type of situation correctly. But it's basically the same approach.
View Replies !
Hard Form Validation Issue
I have a mail form, where I would like the users to enter a secret code and check one checkbox before the form are processed and the values can mailed. Otherwise stop and display an error. But it won't work. What's wrong with my nice newbie-code? Here it is: The form: <div> <form method="post" action="process.php"> <p>Name:</p> <input name="name" type="text" /> <p>Email:</p> <input name="email" type="text" /> <p>Subject:</p> <input name="subject" type="text" /> <p>Message:</p> <textarea name="message" rows="6"></textarea> <p>Enter secret send-code:</p> <input name="secret_code" type="text" /> <p>Agree to terms?:</p> Yes <input name="check[]" type="checkbox" value="yes" /> No <input name="check[]" type="checkbox" value="no" /> <br /> <input type="submit" name="submit" value="Send" /><input type="hidden" name="do" value="send" /><input type="reset" name="reset" value="Reset" /> </form> </div> Here is process.php: <?php //validating input fields and checkbox, secret code is SECRET and required checkbox value has to be "yes" if (empty($_POST['secret_code'])) { exit(); } if (strcmp($_POST['secret_code'],"SECRET")) if(strcmp($_POST['check'],"") !="yes")) { exit(); } if(strcmp($_POST['check'],"yes")) { $do = ($_POST['do']); if($do == "send") { $recipient = "secret_mail@somedomain.com"; $subject = ($_POST['subject']); $name = ($_POST['name']); $email = ($_POST['email']); $message = ($_POST['message']); $formsend = mail("$recipient", "$subject", "$message", "From: $email ($name) Reply-to:$email"); echo ("<p>Thanks, success!</p>"); } } else { echo "You failed to enter secret code, or you didn't agree to the terms, submit cancelled..."; } } ?>
View Replies !
Basic Knowledge Hard To Find
I'm looking for PHP code, to allow me to connect to a My SQL database, and add records, delete records, modify records, and view records. I kow this can be done through the My SQL features on PHP and I believe, according to the book I'm using, that the following code is correct, but it does not seem to be working. <?php // connect to database server $dbcnx = @mysql_connect ('isis.sunderland.ac.uk', '****', '****'); if (!$dbcnx) { exit ("<p>Unable to connect to the ' 'database server at this time.</p>"); } if (!@mysql_select_db('cc2ake')) { exit('<p>Unable to locate the joke ' . 'database at this time.</p>'); } /?> This is where i believe im having most problems as it does not seem to be connecting. Is this code correct to allow me to connect to a database.
View Replies !
Using Sprintf With Queries And The %s Are Making It Hard
I like using the sprintf function to build query strings. I need to put %'s in the query text for the date_format() string, for example: SELECT Date_Format(birthday_dt, '%b %D, %Y') as birthday_dt_f WHERE person_id = �' But sprintf has its own way of dealing with %'s, and I can't get it to ignore the %'s in the date_format part. I've tried escaping the %'s with backslashes; that's all I can think to try. The following code gives a "too few arguments for sprintf" error. Code:
View Replies !
Why Is IE Giving Me Such A Hard Time With Readfile()?
I use the following code to display a flash file: header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // some day in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Content-Length: ".filesize($file)); header("Content-type: application/x-shockwave-flash"); header("Cache-Control: private"); header("Expires: 0"); @readfile($file); exit(); It works like a charm in Firefox, but in IE, sometimes the movie loads, but most of the time, it doesnt. I right click and it says movie not loaded. Some of the files are 9MB, but the ones I am trying to load are less than 2MB. I am no longer using sessions on the page which was the original problem, so thats not it. Is it my headers thats causing this? I need to keep the flash files in a private directory, and this seems to be the only way to do this.
View Replies !
Hard Coded Authentication Error
Just trying a basic PHP authentication script (printed below). When the page executes, I receive a login box, but after entering 'user' and 'password' (respectively), the login box pops up again and eventually sends me the authentication error. I am using a WAMP5 environment. Are there, perhaps, any Apache or PHP5 directives that need to be adjusted? Code: if ((!isset($_SERVER['PHP_AUTH_USER'])) || (!isset($_SERVER['PHP_AUTH_PW'])) || ($_SERVER['PHP_AUTH_USER'] != 'user') || ($_SERVER['PHP_AUTH_PW'] != 'password')) { header('WWW-Authenticate: Basic realm="Secret Page"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authentication Unsuccessful.' exit; }else{echo("success");}
View Replies !
Accessing Files From A Different Drive
I'm building a web application using PHP to play my mp3z. My first step is to just list the albums that I have. Each album is a folder on my hard drive. The problem I am having is that I'm trying to list these folders from a different drive. For instance: ----------------------- <?php $dir = "/"; // Open a known directory, and proceed to read its contents if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if ($file != "." && $file != "..") { echo "$file";?><br><? } } closedir($dh); } } ?> ------------------------- Displays: AUTOEXEC.BAT boot.ini CONFIG.SYS Documents and Settings eclipse .. .. .. -------------------------- -> The above code shows me that the root directory is the contents in my C drive. I have organized my hard drive to keep my music in a different partition. (M:). So my question is, how can I list the files in my M: (which contains my music albums)?
View Replies !
Set The Include_path In Php.ini Any Network Drive
We are working on a program to read the tnsnames.ora file. When we try and set the include_path in php.ini any network drive it can not find the file. We can see that the file is there and if we set the include_path to a local drive it works without a problem. We Have tried all the following include_path="G:orawin etworkadmin" include_path="EASTvol1orawin etworkadmin" include_path="111.11.11.111vol1orawin etworkadmin" None work. Any Ideas?
View Replies !
Stop Drive Browsing
Need a solution if you can, Ive built a file browsing function thats gonna be part of my CMS, Im running it local on a windows apache server, I pass values via the url. Doing it this way u can browse to any drive on my pc. (not good) It dont have to be super secure as only a admin will be looking at the script and theres code in place to protect the script unless your a admin. Can anyone help me stopping the admin or even myself from passing w: or c: as the dir and viewing the contents of my drives. I carnt just put a drive block in , i just want to stop people from going below www/ or public_html as it will be on. Code:
View Replies !
Php Include On Network Drive
I've recently setup apache with an alias to my network drive, so when I type localhost/work/ it will fetch the network address //marge/share/www/ when I type localhost/work/index.php I get the following error: Warning: Failed opening '//marge/share/www/index.php' for inclusion (include_path='.;c:php4pear') in Unknown on line 0 Is there a setting in PHP which I need to change for it to have access to my drive? or am I missing something??
View Replies !
Error After Formatting The Drive
I installed PHPTriad and I changed the location of php files from C:/apache/htdocs to D:/mywork and I modified the httpd.conf and everything was fine But two days ago I formatted drive D and after formatting it I created a folder mywork and after writing php files and when I try to display it I have this error Internal Server Error. The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
View Replies !
|