Solved

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

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

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 82

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Re-imbursement Claim System 3 24
Creating a slider 12 34
Why does my array not "dump?" 5 17
two tables one button 11 10
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now