Solved

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

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

Independent Software Vendors: 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

Suggested Solutions

Title # Comments Views Activity
Link failure 16 63
Wordpress Query 5 44
while read ID; do 4 55
Group By Function Required in PDF Output 21 33
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

756 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