Solved

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

Posted on 2015-02-12
3
93 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 83

Accepted Solution

by:
Dave Baldwin earned 500 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 83

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

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…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

789 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