vmware-archive / webcommander

Powerful, flexible, intuitive and most importantly simple. That is what a real automation solution should be. No matter how complicated the task is, we'd like to turn it into a single click. Is that possible? Not without webcommander :)
MIT License
165 stars 47 forks source link

Upload File (Walnut) #146

Closed jrob24 closed 8 years ago

jrob24 commented 8 years ago

Did any of the recent updates change anything with the way files are uploaded? I noticed today that files are no longer being uploaded to www\upload. This was working last week. Since updating to the latest code it doesn't appear to be working any longer.

9whirls commented 8 years ago

There is a limit on the file size to upload. Please try with a small txt file.

jrob24 commented 8 years ago

Yes this was a very small file, 1KB. It is not even creating the directory with the ip under upload.

jrob24 commented 8 years ago

I did notice however that folders and files are being saved to the history folder. So it appears to be working file for the history folder, but not the upload folder.

9whirls commented 8 years ago

Do you mean the file is uploaded to history folder instead of upload folder?

Check your exec.php https://github.com/vmware/webcommander/blob/walnut/www/exec.php#L224

jrob24 commented 8 years ago

No, the correct files are being created in the history folder. I just mentioned that because I assumed it used the same functions for creating folders and uploading files.

9whirls commented 8 years ago

Could be an authentication issue. I can still upload file to the upload folder on my own server.

jrob24 commented 8 years ago

I don't think it's an authentication issue. Can you tell me the steps Walnut takes to upload a file to the upload folder? That way I can try and test each step.

jrob24 commented 8 years ago

Ok after many hours of troubleshooting I finally figured it out. So apparently the parameter names are case sensitive. My parameter was named $File, not $file. I discovered this when I tried uploading a file with a built in script. I was looking in the exec.php and it looks like the following line should rename all of the parameters to lower case:

foreach($params as &$param){
  $name = strtolower((string)$param["name"]);

Is this not the case?

9whirls commented 8 years ago

I added that line in order to ignore the case of parameter names. I guess the issue is I didn't address this in javascript. However, I feel the best way to avoid this is to use only lower case in parameter names in ps1 files.

jrob24 commented 8 years ago

I believe it would be easier for end users if they didn't have to worry about case sensitivity of their paramater names, especially since PowerShell is not a case sensitive language.

If leaving the parameters as lower case-sensitive it would be helpful to future users to include this information in some documentation to avoid confusion and future issue creation.

Thanks again.