Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EPP » UDC - php script(How upload.php file should looks like?)
UDC - php script [message #695529] Mon, 11 July 2011 19:55 Go to next message
Lukas  is currently offline Lukas
Messages: 6
Registered: July 2011
Junior Member
Hi,

I need to change UDC upload target to my server, but I've got some problems with that.
First thing, which i done is modification of eclipse.ini file (tell me if everything is ok):

-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Xms40m
-Xmx384m
-Dorg.eclipse.epp.usagedata.recording.upload-url=myserver/upload.php


Next, I tried to write php script to upload files: uploadx.csv, but nothing work. Of course I set rights 777 there where i want to upload files.
I used simple upload scripts on my websites before, but this one is too hard for me, and don't know how integrate this with eclipse.
Could you tell me how to write this php script?

Best wishes,
Luke

[Updated on: Mon, 11 July 2011 19:57]

Report message to a moderator

Re: UDC - php script [message #695793 is a reply to message #695529] Tue, 12 July 2011 10:51 Go to previous messageGo to next message
Wayne Beaton is currently offline Wayne Beaton
Messages: 496
Registered: July 2009
Senior Member
Are you getting any error messages anywhere? Anything in any of the logs?

Do you know if a connection is being made with the server?

There is sample server code on Bug 221104. Have you looked at that?

https://bugs.eclipse.org/bugs/show_bug.cgi?id=221104

Wayne

On 07/11/2011 07:55 PM, Lukas wrote:
> Hi,
>
> I need to change UDC upload target to my server, but I've got some
> problems with that.
> First thing, which i done is modification of eclipse.ini file (tell me
> if everything is ok):
>
> -startup
> plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
> --launcher.library
> plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502
> -showsplash
> org.eclipse.platform
> --launcher.XXMaxPermSize
> 256m
> --launcher.defaultAction
> openFile
> -vmargs
> -Xms40m
> -Xmx384m
> -Dorg.eclipse.epp.usagedata.recording.upload-url=myserver/upload.php
>
>
> Next, I tried to write php script to upload files: uploadx.csv, but
> nothing work. Of course I set rights 777 there where i want to upload
> files.
> I used simple upload scripts on my websites before, but this one is too
> hard for me, and don't know how integrate this with eclipse.
> Could you tell me how to write this php script.
>
> Best wishes,
> Luke
Re: UDC - php script [message #695887 is a reply to message #695529] Tue, 12 July 2011 14:34 Go to previous messageGo to next message
Lukas  is currently offline Lukas
Messages: 6
Registered: July 2011
Junior Member
Hi,

Thank you for server files.
I need to define path, where i can save these uploaded files on my server. I needn't database, I just want upload all cvs files to my server. Is it possible to do it easy without database?
I tried to modify uploadmanager.class.php, I paste this code into first foreach loop:
move_uploaded_file($_FILES['name']['tmp_name'],"/myserver/pliki/".$_FILES['tmp_name']['name']);

but it doesn't work.
Eclipse give me message:
Usage data uploaded to *****************/server/upload.php in 1281 milliseconds,
but there is no files on my server.
Re: UDC - php script [message #695893 is a reply to message #695887] Tue, 12 July 2011 15:02 Go to previous messageGo to next message
Wayne Beaton is currently offline Wayne Beaton
Messages: 496
Registered: July 2009
Senior Member
Look at the documentation for move_uploaded_file [1]. It moves only one
file, not an array.

Try:

move_uploaded_file($_FILES['uploads']['tmp_name'][0],"/myserver/pliki/".$_FILES['uploads']['tmp_name'][0]);

The order in which you dereference the $_FILES variable is important.

HTH,

Wayne

[1] http://php.net/manual/en/function.move-uploaded-file.php

On 07/12/2011 02:34 PM, Lukas wrote:
> Hi,
>
> Thank you for server files.
> I need to define path, where i can save these uploaded files on my
> server. I needn't database, I just want upload all cvs files to my
> server. Is it possible to do it easy without database?
> I tried to modify uploadmanager.class.php, I paste this code into first
> foreach loop:
> move_uploaded_file($_FILES['name']['tmp_name'],"/myserver/pliki/".$_FILES['tmp_name']['name']);
>
> but it doesn't work.
> Eclipse give me message:
> Usage data uploaded to *****************/server/upload.php in 1281
> milliseconds,
> but there is no files on my server.
>
Re: UDC - php script [message #695909 is a reply to message #695893] Tue, 12 July 2011 15:55 Go to previous messageGo to next message
Lukas  is currently offline Lukas
Messages: 6
Registered: July 2011
Junior Member
I paste this code into UploadManager script, this is small part:
foreach ($_FILES["uploads"]["error"] as $index => $error) {
			if ($error == UPLOAD_ERR_OK) {
				$tmp_name = $_FILES["uploads"]["tmp_name"][$index];
				$name = $_FILES["uploads"]["name"][$index];
				$size = $_FILES["uploads"]["size"][$index];
				move_uploaded_file($_FILES['uploads']['tmp_name'][0],"/home/zenspryt/pliki/".$_FILES['uploads']['tmp_name'][0]);
				try {
					$this->handle_file($upload_id, $tmp_name);
					echo "file-ok:$name\n";
				} catch (UploadException $e) {
					$this->log($e);
					echo "file-err:$name\n";
				}
			} else {
				$this->log("Failed to access file $index with error code $error.");
				echo "file-err:$name\n";
			}
		}
	}

It still doesn't work. What's wrong with that?
Re: UDC - php script [message #695934 is a reply to message #695909] Tue, 12 July 2011 17:18 Go to previous messageGo to next message
Wayne Beaton is currently offline Wayne Beaton
Messages: 496
Registered: July 2009
Senior Member
FWIW, there's no rule that says the server has to be PHP.

The only thing that I can think of is that
$_FILES['uploads']['tmp_name'][0] probably starts with a '/' which means
that you'll have two of them. Not sure if that's necessarily wrong.

The file name also starts with a path. It may be failing because it
can't create the directory.

If you add -Dorg.eclipse.epp.usagedata.recording.log-server=true to the
vmargs, you'll get some log information back from the server that might
be helpful.

Wayne

On 07/12/2011 03:55 PM, Lukas wrote:
> I paste this code into UploadManager script, this is small part:
>
> foreach ($_FILES["uploads"]["error"] as $index => $error) {
> if ($error == UPLOAD_ERR_OK) {
> $tmp_name = $_FILES["uploads"]["tmp_name"][$index];
> $name = $_FILES["uploads"]["name"][$index];
> $size = $_FILES["uploads"]["size"][$index];
>
> move_uploaded_file($_FILES['uploads']['tmp_name'][0],"/home/zenspryt/pliki/".$_FILES['uploads']['tmp_name'][0]);
>
> try {
> $this->handle_file($upload_id, $tmp_name);
> echo "file-ok:$name\n";
> } catch (UploadException $e) {
> $this->log($e);
> echo "file-err:$name\n";
> }
> } else {
> $this->log("Failed to access file $index with error code
> $error.");
> echo "file-err:$name\n";
> }
> }
> }
>
> It still doesn't work. What's wrong with that?
Re: UDC - php script [message #695960 is a reply to message #695934] Tue, 12 July 2011 19:20 Go to previous message
Lukas  is currently offline Lukas
Messages: 6
Registered: July 2011
Junior Member
In the log informations, I got some errors connected with dbconnection.class.
Is the simple way to upload this files without using databases?
I thought about simple php script, which will be able to upload cvs files.
Do you know how to write one?
Previous Topic:Regarding UDC in RCP
Next Topic:How extend "org.eclipse.app.usagedata.recording" UDC plugin?
Goto Forum:
  


Current Time: Wed Aug 20 18:39:59 EDT 2014

Powered by FUDForum. Page generated in 0.01622 seconds