?
Solved

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

Posted on 2015-02-12
3
Medium Priority
?
97 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: 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

This article discusses how to implement server side field validation and display customized error messages to the client.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

718 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