Welcome! Log In Create A New Profile

Advanced

$upload_file_name is null

October 18, 2012 05:45AM
Hi,

I am trying to upload file from client(simple HTML multipart post request) to my Nginx server.
I can upload the file on Nginx server successfully but $upload_file_name is null. I am using Nginx log mechanisam to
see the value as below:-

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'
' ** "$upload_file_name" **';

My Nginx conf file:

location /upload {

# Pass altered request body to this location
upload_pass @test;

# Store files to this directory
# The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist
upload_store /www/test;

# Allow uploaded files to be read only by user
upload_store_access user:rw group:r all:r;

# Set specified fields in request body
upload_set_form_field $upload_field_name.name $upload_file_name;
upload_set_form_field $upload_field_name.content_type "$upload_content_type";
upload_set_form_field $upload_field_name.path "$upload_tmp_path";

# Inform backend about hash and size of a file
upload_aggregate_form_field "$upload_field_name.md5" "$upload_file_md5";
upload_aggregate_form_field "$upload_field_name.size" "$upload_file_size";

upload_pass_form_field "^submit$|^description$";
upload_cleanup 400 404 499 500-505;

HTML page:

<html>
<head>
<title>Test Server</title>
<script src="http://code.jquery.com/jquery.min.js"></script>
</head>
<body>
<form id="upload-form" method="post" target="upload_target" enctype="multipart/form-data" action="/upload">
<input name="file" id="file" size="27" type="file" /><br />
<input type="submit" name="action" value="Upload" /><br />
<iframe id="upload_target" name="upload_target" src="" style="width:100%;height:100px;border:0px solid #fff;"></iframe>
</form>
</body>
</html>

Am I missing here something or do I need to add some extra code here to get values of $upload_file_name, "$upload_content_type" etc ? Or do I need to modify my client code ?

Thank you.
M
Subject Author Posted

$upload_file_name is null

Megha October 18, 2012 05:45AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 130
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready