Help with cURL

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with cURL
# 1  
Old 07-28-2011
Help with cURL

Hi all;

first of all i need to clarify that i am new to apache2 server configuration and for some needs i want to transfer some files using curl to web directory,so please bear with me:

following is the command i m running to transfer file to my web directory:

curl -T "q" http://localhost/website

where "q" is the name of the file and the response i get is

<title>301 Moved Permanently</title>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://localhost/website/">here</a>.</p>
<address>Apache/2.2.16 (Ubuntu) Server at localhost Port 80</address>

my configuration for httpd.conf looks like

 <Directory /var/www/website>
   Options none
   AllowOverride none
   Order deny,allow
   Deny from all
   <Limit PUT POST GET>
        Order deny,allow
        Allow from all

where i m allowing PUT option to be used

now the problem is that file "q" does not appear in /var/www/website directory even though after getting moved permanenty message. acording to my understanding what i came to know after reading "man curl" is that -T allows you to transfer files directly to server unlike some scripts what we use in case of forms,correct me if i am wrong.

please share some inputs regarding this which will be more than helpful for me.If possible some sample conf files for working setup.

# 2  
Old 07-28-2011
What are the permissions and ownerships on that directory? The web server will need write-access.
# 3  
Old 07-28-2011
permissions and ownership: www directory/
drwxr-xr-x  3 www-data www-data 4096 2011-07-28 22:57 www

of website/ directory
drwxr-xr-x  2 www-data www-data 4096 2011-07-28 22:59 website

and snippet from cat passwd

have given 0777 permissions to whole www/ dir later
# 4  
Old 07-28-2011
You've given write-access for your web folder to absolutely everything on your system, you might want to fix that. 777 is not the magic sledgehammer to solve all permissions problems.

I've tried to get this operating myself since you asked, and had even less progress than you yet, sorry Smilie
# 5  
Old 07-28-2011
Might this be the problem?

curl -T "q" http://localhost/website/

Reading from man curl:
-T/--upload-file <file>

NOTE that you must use a trailing / on the last directory to really prove to Curl that there is no file name or curl will think that your last directory name is the remote file name to use. That will most likely cause the upload operation to fail.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

CURL syntax

Topic : cmd to check status of url using Curl I have below 2 lines which r working fine /usr/bin/curl -u user:pasword http://hostname /usr/bin/curl -connect-timeout=10 http://hostname Now I want to use user:pasword and connect-timeout parameter in one line /usr/bin/curl -u user:pasword... (1 Reply)
Discussion started by: sam@sam
1 Replies

2. Shell Programming and Scripting

Using CURL in a script

Hi all so I'm new to scripting but I am making a script that is a url shortener. It will take a url off the command line and spit back the shortened version using's api this is what I have so far if then echo "You must supply a URL." exit 1 fi read url... (3 Replies)
Discussion started by: subway69
3 Replies

3. Shell Programming and Scripting

Using CURL for FTP

Hello, I am using curl command to interact with the FTP server. I have gathered some information around downloading / uploading of files using curl command. However, I couldn't find any information around 1) Listing all the files on FTP server in any given folder having a specific extn. (... (3 Replies)
Discussion started by: amitshete
3 Replies

4. Shell Programming and Scripting

Using curl in commandline

Hi, I am using curl to hit a url using http in solaris 10 using commandline, I want to transfer an attachment(using multipart curl -F) also as a part of the request. If anyone has used kindly help me with the syntax. I am using below command: /usr/local/bin/curl -v... (1 Reply)
Discussion started by: manishmaha
1 Replies

5. Shell Programming and Scripting

using curl in a script

Hello everyone I'm currently using a script to upload files (different file names, but same date) to an ftp server (see below) #!/bin/sh # Set the variables HOST=<host> USER=<user> PASSWD=<password> ftp -i -n $HOST <<END_SCRIPT user ${USER} ${PASSWD} mput... (0 Replies)
Discussion started by: soliberus
0 Replies

6. Solaris

Curl Installation

Hi, Has anyone installed curl on solaris? I tried installing curl-7.19.4 without any effect. Here's what i have done so far: Copied the package curl-7.19.4-sol8-sparc-local under a certain dir. Tried to add the path in PATH variable. But when I type curl it says bash: curl: command not found.... (2 Replies)
Discussion started by: King Nothing
2 Replies

7. Shell Programming and Scripting

Curl command

Hello, I try to take out of the command curl the info of the time... time curl --write \"Downloaded %{time total}\" -o ...... but having some problem. (1 Reply)
Discussion started by: protocomm
1 Replies

8. Shell Programming and Scripting

use of curl

I have to transfer a file from my aix box to another server using ftps protocol, how can i achieve this using curl preferably or any other utility. Regards Sandeep (0 Replies)
Discussion started by: jayawantsandeep
0 Replies

9. AIX

use of curl

Hi guys , need some help I have to transfer a file from my aix box to another server using ftps protocol, how can i achieve this using curl preferably or any other utility. Thanks Sandeep (0 Replies)
Discussion started by: jayawantsandeep
0 Replies

10. Shell Programming and Scripting


Aren't there any way to download files as below? For example, I want to download all .html files under the root directory of curl -O*.html This won't work, but please tell me the way to do this. Well, the best way is to get the file list of the directory, but i... (6 Replies)
Discussion started by: Euler04
6 Replies
Login or Register to Ask a Question