Solved

Uploading file not in right format

Posted on 2006-11-13
6
168 Views
Last Modified: 2010-03-04
Hi, i'm using an apache web-based application to upload certain files. Anyway, the files must be in a certain format. The format should be <server>-<version#>.zip.

Let's say the service name is service. In the past I was able to put something like server.3.5.6.zip and it would work. (Or server.3_5_6.zip).

Well, we migrated to another physical linux server, same specs (Red Hat ES 3.0). Copied all the same files over. Now when i try an upload a file, it won't take any files with "dots" in them, I get a format error. For example server.3.5.6.zip will not work but server.3_5_6.zip.

I went to the location of the page and it calls a file called deployment.php and in there it says:
$regex_match       = "$service-[0-9a-zA-Z_-]+\.zip" ;
$format_msg        = "ERROR - File must be in the format:  $service-version#.zip!" ;

I'm getting the format error. Now in the regex_match variable it doesn't say anything about a "." character. My question is, why was it working before? And how would I get it to accept "." in the version name?

The only difference between the old configuration and new one is that hte old was a virtual host while the new is the main (only) host.
0
Comment
Question by:pieman8080
  • 3
  • 2
6 Comments
 
LVL 6

Expert Comment

by:bimal_linux
ID: 17937021
what is the magic_quotes_gpc status in your php.ini?

Bimal
0
 

Author Comment

by:pieman8080
ID: 17942330
magic_quotes_gpc = On
0
 
LVL 16

Expert Comment

by:HackneyCab
ID: 17942627
I'm not sure I understand your question. But the regex you demonstrate looks wrong. The $ symbol means "end of pattern", not "start of pattern". Does this do what you are aiming for:

$regex_match = "^service-[0-9a-zA-Z_-]+\.zip$";

or am I misunderstanding your question?
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 16

Accepted Solution

by:
HackneyCab earned 500 total points
ID: 17942655
Ah, sorry, you're trying to use $service as a variable. Also, I note that your pattern does not permit periods in the text before the file extension. Try this instead of my above suggestion:

$regex_match = $service.'-[0-9a-zA-Z_.-]+\.zip";

That will convert $service to a string (outside of the quotes, to be safe) and it allows periods in the pattern defined by the character class.
0
 

Author Comment

by:pieman8080
ID: 17942788
It worked, thank you! Note i didn't use the ' character. I tried putting the "." in the string but after the _- and it didn't work. When I put it in the middle as you suggested it worked.
0
 
LVL 16

Expert Comment

by:HackneyCab
ID: 17947142
Sorry, I was using the single-quote ' symbol to start the pattern string, but I've foolishly ended the pattern string with a double-quote " symbol. My bad.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now