Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do I fix this script to upload this zip file to the server

Posted on 2015-02-12
3
Medium Priority
?
99 Views
Last Modified: 2015-02-12
How do I fix this PHP script to upload a zip file to the server?  I am getting an error on the "write".  

Parse error: syntax error, unexpected 'w' (T_STRING)

<?php



$rebateurl = "http://www.website.com/archive/rebateImages.zip";



// save that image to our server!
$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $rebateurl);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
// Getting binary data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$image = curl_exec($ch);
curl_close($ch);
$new_filename = "rebateImages.zip";


$f = fopen('$new_filename, 'w');   //ERROR HERE
fwrite($f, $image);
fclose($f);


?>

Open in new window



Thanks for your help!
0
Comment
Question by:lawrence_dev
  • 2
3 Comments
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 total points
ID: 40607180
You had an extra single quote.
$f = fopen($new_filename, 'w');   //ERROR HERE

Open in new window

0
 

Author Comment

by:lawrence_dev
ID: 40607183
THANK YOU DAVE!  I looked and looked and could not find it!!  Thanks for the help!!
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 40607200
You're welcome.  That's one my most common errors cause it looked right when I typed it!!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question