cannot open dynamic fileNAME for writing

Donnieclark
Posts: 34
Joined: Tue Oct 31, 2017 7:41 pm

cannot open dynamic fileNAME for writing

Postby Donnieclark » Tue Nov 21, 2017 12:20 am

How do I open a file where $dataFILE is input from an HTML form? I am continually getting error 500.
I have done quite a bit of research and all examples and explanations have a known file that is being opened instead of a file based on form data.

I can
open(FILE, "data/$dataFILE.txt");
to read, where $dataFILE is input from an html link.

What I cannot do is
open(FILE, ">data/$dataFILE.txt");
print FILE "this is a test\n";
close(FILE);
to create a file where the file name is input from an html form and then write to it.

I can
open(FILE, ">data/$datafile.txt");
print FILE "this is a test\n";
close(FILE);
on accident (forgot to capitalize 'FILE'), where $datafile has no value. In this case, .txt is created and I can write to it.

Any help would be appreciated!

I didn't find the right solution from the Internet.

References
http://forums.devshed.com/perl-programm ... 75828.html


Product Video Ad

Who is online

Users browsing this forum: No registered users and 1 guest